Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public byte[] getBody() throws AuthFailureError {
- String httpPostBody="grant_type=password&username=Alice&password=password123";
- // usually you'd have a field with some values you'd want to escape, you need to do it yourself if overriding getBody. here's how you do it
- try {
- httpPostBody=httpPostBody+"&randomFieldFilledWithAwkwardCharacters="+URLEncoder.encode("{{%stuffToBe Escaped/","UTF-8");
- } catch (UnsupportedEncodingException exception) {
- Log.e("ERROR", "exception", exception);
- // return null and don't pass any POST string if you encounter encoding error
- return null;
- }
- return httpPostBody.getBytes();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement