Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Automatic encoding of $ breaks OData APIs #592

Closed
pimterry opened this issue Nov 13, 2017 · 5 comments
Closed

[Feature Request] Automatic encoding of $ breaks OData APIs #592

pimterry opened this issue Nov 13, 2017 · 5 comments

Comments

@pimterry
Copy link

  • Insomnia Version: v5.6.3
  • Operating System: Linux

Details

Making a request like http://example.com/abc?$expand=my_expansion actually makes a request like http://example.com/abc?%24expand=my_expansion (encoding the $ to a %24).

This can be painful because it means it's impossible to ever pass any options to any OData API, since they all require a literal $ option prefix: http://docs.oasis-open.org/odata/odata/v4.0/os/part2-url-conventions/odata-v4.0-os-part2-url-conventions.html#system-query-optionsurl5.1.

I've now seen from #417 that there's an option to disable this encoding, request by request, but it's a bit awkward when 100% of my requests need this to be individually turned off, for a major API standard. Lots of other tools have this problem too, annoyingly, but as a useful datapoint Swagger disabled this behaviour, asked for feedback from anybody who does need this encoded, and got zero further responses.

@gschier
Copy link
Contributor

gschier commented Nov 13, 2017

I'm still not sure what the best way to deal with special characters is. It's a pretty difficult thing to change this far into the app's lifecycle. I'm thinking the best thing to do might be to make the encodable characters configurable within the workspace settings.

I should also point out that the setting you mention only applies to query string parameters defined in the URL (not in the friendly Query tab). If that works for you, it's actually possible to write a simple plugin to toggle this setting for every request.
https://support.insomnia.rest/article/26-plugins?auth=true#request-hook-api

module.exports.requestHooks = [
  context => {
    context.request.settingEncodeUrl(false)
  }
];

@gschier gschier changed the title Automatic encoding of $ breaks OData APIs [Feature Request] Automatic encoding of $ breaks OData APIs Nov 13, 2017
@pimterry
Copy link
Author

I'm thinking the best thing to do might be to make the encodable characters configurable within the workspace settings.

That would work reasonably for me. OData/non-OData is very closely tied to my workspaces (i.e. some are 90%, some are 0%, not much between). It's not super discoverable and it'll keep catching people out first time, but I can see why you'd be cautious around breaking existing behaviour, in case anybody does rely on these being encoded. It's not perfect, but that would be a good strict improvement for me.

Getting it working in the friendly query tab too would be even better of course 😃

Thanks for the plugin tip! I had no idea any of that existed.

@Atvaark
Copy link
Contributor

Atvaark commented Nov 16, 2017

My OData APIs are callable with Insomnia. But there's a small issue with URL Strings in the response messages.
The linkified OData URLs like {..., "@odata.nextLink": "http://localhost:8080/odata/EntitySet?$top=1&$skip=1"} also stop before the first literal $ symbol. (http://localhost:8080/odata/EntitySet?.)

@gschier
Copy link
Contributor

gschier commented Nov 16, 2017

@Atvaark that commit should address your issue ^

@gschier
Copy link
Contributor

gschier commented Nov 16, 2017

Going to close this in favor of #605

Please move all further discussion there 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants