Skip to content

Fix "q" query parameter encoding#55

Merged
lbalmaceda merged 1 commit intomasterfrom
fix-query-encoding
May 23, 2017
Merged

Fix "q" query parameter encoding#55
lbalmaceda merged 1 commit intomasterfrom
fix-query-encoding

Conversation

@lbalmaceda
Copy link
Copy Markdown
Contributor

@lbalmaceda lbalmaceda commented May 23, 2017

It seems that OkHttp it's not really URL encoding the query parameters, or that some chars are missing from that implementation, which affects both the UsersEntity#list and LogsEntity#list methods. This PR encodes the query value (and only that case) using java.net.URLEncoder. The client/entity later, only for that parameter, adds it to the request as a pre-encoded query parameter, in order to avoid OkHttp to encode again the % escaped chars.

Personally I don't like being checking in the for loop for a specific parameter name and adding it in a different way. Maybe it's better that the whole networking impl uses the URLEncoder first for all parameters and then adds them as "already encoded" to the request. Opinions?

Fixes #54

@lbalmaceda lbalmaceda requested a review from nikolaseu May 23, 2017 18:41
@lbalmaceda lbalmaceda force-pushed the fix-query-encoding branch from 068924e to 330d972 Compare May 23, 2017 18:49
@lbalmaceda lbalmaceda added this to the v1-Next milestone May 23, 2017
@lbalmaceda lbalmaceda merged commit 072e005 into master May 23, 2017
@lbalmaceda lbalmaceda deleted the fix-query-encoding branch May 23, 2017 20:33
@lbalmaceda lbalmaceda modified the milestones: v1-Next, 1.1.0 May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants