Skip to content

Instantly share code, notes, and snippets.

@novachevskyi
Created July 4, 2017 13:28
Show Gist options
  • Save novachevskyi/71529d8fdecf120e626af227193a9e0f to your computer and use it in GitHub Desktop.
Save novachevskyi/71529d8fdecf120e626af227193a9e0f to your computer and use it in GitHub Desktop.
package com.novachevskyi.okhttptest;
import org.junit.Test;
import okhttp3.HttpUrl;
import static org.junit.Assert.assertEquals;
public class OkHttpBug {
@Test
public void test() throws Exception {
HttpUrl.Builder builder = HttpUrl.parse("https://www.google.com/").newBuilder();
builder.addEncodedPathSegment("mobile");
builder.addEncodedPathSegment("#!");
builder.addEncodedPathSegment("id");
builder.addQueryParameter("platform", "android");
String url = builder.build().toString();
assertEquals("https://www.google.com/mobile/#!/id?platform=android", url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment