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
Changes from 1 commit
e61cccf
6b50a04
681381d
a8d4e87
b528d57
84c482f
92ac9ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,25 +53,30 @@ public class UrlEncodedContent extends AbstractHttpContent { | |
/** Use URI Path encoder flag. False by default (use legacy and deprecated escapeUri) */ | ||
private boolean uriPathEncodingFlag; | ||
|
||
/** @param data key name/value data */ | ||
/** | ||
* Initialize the UrlEncodedContent with the legacy and deprecated escapeUri encoder | ||
* @param data key name/value data | ||
* */ | ||
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 | ||
* @param data key name/value data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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. |
||
* @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 commentThe reason will be displayed to describe this comment to others. Learn more. Escapes --> escapes |
||
* 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 commentThe reason will be displayed to describe this comment to others. Learn more. Boolean --> boolean |
||
super(UrlEncodedParser.MEDIA_TYPE); | ||
setData(data); | ||
this.uriPathEncodingFlag = useUriPathEncoding; | ||
} | ||
|
||
@Override | ||
public void writeTo(OutputStream out) throws IOException { | ||
Writer writer = new BufferedWriter(new OutputStreamWriter(out, getCharset())); | ||
boolean first = true; | ||
|
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?