Skip to content

Prevent encoding query parameters #1445

@xeinebiu

Description

@xeinebiu

New Issue Checklist

  • I have searched for a similar issue in the project and found none
dependencies:
  flutter:
    sdk: flutter
  http: ^0.13.4
  json_annotation: ^4.4.0
  dio: ^4.0.4

Issue Description and Steps

https://github.com/flutterchina/dio/blob/develop/dio/lib/src/options.dart#L545

The above code always does the encoding of query parameters by using + instead of spaces. The issue is, some servers do not understand the +, instead they use %20.

Tried to manually encode the query paramater value but then it ends up to duplicated encoding.

  • How to prevent encoding or provive a Query Parameter encoder to support this case ?
// Current (Term=Hello World)
baseUrl/search?term=HELLO+WORLD

Expected (Term=Hello World)
// baseUrl/search?term=HELLO%20WORLD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions