-
Notifications
You must be signed in to change notification settings - Fork 452
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
feat: add flag to allow UrlEncodedContent to use UriPath escaping #1100
feat: add flag to allow UrlEncodedContent to use UriPath escaping #1100
Conversation
…ad of the deprecated urlEncoder
idTokenWithAudience method not tested (I don't know how to do this to be useful) Depend on this update googleapis/google-http-java-client#1100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could do this unconditionally but that's risky.
google-http-client/src/main/java/com/google/api/client/http/UrlEncodedContent.java
Outdated
Show resolved
Hide resolved
google-http-client/src/main/java/com/google/api/client/http/UrlEncodedContent.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* @param data key name/value data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the key is a name and a value? That's surprising.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste of the legacy comment (see line 56 of the file.) I kept the legacy signature and behavior, and I added mine with additional parameter. This one is unchanged (and I guess its description also!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you want me to improve both or if keeping the existing description is ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I look at this the weirder it is. Why is this an object instead of a Map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree; it's strange and I don't know why to use an Object instead of a Map! However to ensure the compatibility with other app that depends on this library, I kept the existing signature.
google-http-client/src/main/java/com/google/api/client/http/UrlEncodedContent.java
Outdated
Show resolved
Hide resolved
Improve variable naming Improve documentation more user oriented.
public UrlEncodedContent(Object data) { | ||
super(UrlEncodedParser.MEDIA_TYPE); | ||
setData(data); | ||
this.uriPathEncodingFlag = false; | ||
} | ||
|
||
/** | ||
* Initialize the UrlEncodedContent with our without the legacy and deprecated escapeUri encoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our --> or?
* @param useUriPathEncoding Escapes the string value so it can be safely included in URI path segments. For details on | ||
* * escaping URIs, see <a href="http://tools.ietf.org/html/rfc3986#section-2.4">RFC 3986 - section | ||
* * 2.4</a> | ||
* @param useUriPathEncoding Escapes the string value so it can be safely included in URI path segments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escapes --> escapes
* * 2.4</a> | ||
* @param useUriPathEncoding Escapes the string value so it can be safely included in URI path segments. | ||
* For details on escaping URIs, see <a href="http://tools.ietf.org/html/rfc3986#section-2.4">RFC 3986 - | ||
* section 2.4</a> | ||
*/ | ||
public UrlEncodedContent(Object data, Boolean useUriPathEncoding) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean --> boolean
per Effective Java
🤖 I have created a release \*beep\* \*boop\* --- ## [1.37.0](https://www.github.com/googleapis/google-http-java-client/compare/v1.36.0...v1.37.0) (2020-10-13) ### Features * add flag to allow UrlEncodedContent to use UriPath escaping ([#1100](https://www.github.com/googleapis/google-http-java-client/issues/1100)) ([9ab7016](https://www.github.com/googleapis/google-http-java-client/commit/9ab7016032327f6fb0f91970dfbd511b029dd949)), closes [#1098](https://www.github.com/googleapis/google-http-java-client/issues/1098) ### Bug Fixes * make google-http-client.properties file shading friendly ([#1046](https://www.github.com/googleapis/google-http-java-client/issues/1046)) ([860bb05](https://www.github.com/googleapis/google-http-java-client/commit/860bb0541bcd7fc516cad14dd0d52481c7c7b414)) ### Dependencies * update protobuf-java to 3.13.0 ([#1093](https://www.github.com/googleapis/google-http-java-client/issues/1093)) ([b7e9663](https://www.github.com/googleapis/google-http-java-client/commit/b7e96632234e944e0e476dedfc822333716756bb)) ### Documentation * libraries-bom 12.0.0 ([#1136](https://www.github.com/googleapis/google-http-java-client/issues/1136)) ([450fcb2](https://www.github.com/googleapis/google-http-java-client/commit/450fcb2293cf3fa7c788cf0cc8ae48e865ae8de8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Fixes #1098
The legacy behavior is kept. Test has been updated