Created
February 21, 2016 16:45
-
-
Save swankjesse/981fcae102f513eb13ed to your computer and use it in GitHub Desktop.
Sample bug report for OkHttp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import okhttp3.Call; | |
import okhttp3.OkHttpClient; | |
import okhttp3.Request; | |
import okhttp3.Response; | |
import okhttp3.mockwebserver.MockResponse; | |
import okhttp3.mockwebserver.MockWebServer; | |
import okhttp3.mockwebserver.RecordedRequest; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import static org.junit.Assert.assertEquals; | |
public class OkHttpBug { | |
@Rule public final MockWebServer server = new MockWebServer(); | |
@Test public void test() throws Exception { | |
server.enqueue(new MockResponse() | |
.addHeader("Content-Type: text/plain") | |
.setBody("abc")); | |
Request request = new Request.Builder() | |
.url(server.url("/path")) | |
.header("User-Agent", "Test Case") | |
.build(); | |
OkHttpClient client = new OkHttpClient(); | |
Call call = client.newCall(request); | |
Response response = call.execute(); | |
assertEquals("text/plain", response.header("Content-Type")); | |
assertEquals("abc", response.body().string()); | |
RecordedRequest recordedRequest = server.takeRequest(); | |
assertEquals("/path", recordedRequest.getPath()); | |
assertEquals("Test Case", recordedRequest.getHeader("User-Agent")); | |
} | |
} |
This is imagration i don't no how to test but trying to get all operating systems to sync
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
java.io.EOFException: \n not found: size=0 content=… #2849