Skip to content

Change of URL encoding behaviour doesn't seem right #1190

@sguillope

Description

@sguillope

This issue is probably related to #1189 but is focused on the encoding of path variables instead. We've recently upgraded to Spring Cloud to Hoxton.SR3 which includes a bump of Spring Cloud OpenFeign from 2.2.1.RELEASE to 2.2.2.RELEASE. This patch version bumps OpenFeign from 10.4.0 to 10.7.4 which seems to contain quite a few important changes.

In particular, there is a change of behaviour around url encoding (#1138) which in our case has broken a couple of things with using path variables. I've created a sandbox project at https://github.com/sguillope/openfeign-url-encoding-issue to make it easier to reproduce the issue.

The 2 problems we've hit are as follows when using a path variable:

  • The colon : character now gets url-encoded to %3A. While not really incorrect, it's not actually required as a colon is a valid character in a path segment (https://tools.ietf.org/html/rfc3986#section-3.3), except for one case which shouldn't apply here. This only broke our integration tests, not production code, so we can easily fix that.
  • The most problematic one is the handling of the forward slash / character. With the latest version, it doesn't get url-encoded in path variables. Fortunately this was caught by our integration tests, otherwise it would have broken our production code. We can't pre-encode it because it will then get double-encoded as %252F instead of %2F.

To summarise:

Input Result Expected
a:path/variable a%3Apath/variable a:path%2Fvariable
path/variable path/variable path%2Fvariable
a:path a%3Apath a:path

Let me know if you need more details.
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    feedback providedFeedback has been provided to the authorwaiting for feedbackIssues waiting for a response from either to the author or other maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions