Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 257 for url (0.13 sec)

  1. samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java

        RequestBody jsonRequestBody = RequestBody.create(
            mapJsonAdapter.toJson(requestBody), MEDIA_TYPE_JSON);
        Request request = new Request.Builder()
            .url("https://www.googleapis.com/urlshortener/v1/url?key=" + GOOGLE_API_KEY)
            .post(jsonRequestBody)
            .build();
    
        try (Response response = client.newCall(request).execute()) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 3.8K bytes
    - Viewed (0)
  2. docs/features/https.md

                      .add("publicobject.com", "sha256/afwiKY3RxoMmLkuRW1l7QsPZTJPwDS2pdDROQjXw8ig=")
                      .build())
              .build()
    
          fun run() {
            val request = Request.Builder()
                .url("https://publicobject.com/robots.txt")
                .build()
    
            client.newCall(request).execute().use { response ->
              if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Dec 24 00:16:30 GMT 2022
    - 10.5K bytes
    - Viewed (0)
  3. okhttp/src/main/kotlin/okhttp3/internal/-ResponseCommon.kt

        }
        return result
      }
    
    fun Response.commonClose() {
      body.close()
    }
    
    fun Response.commonToString(): String = "Response{protocol=$protocol, code=$code, message=$message, url=${request.url}}"
    
    fun Response.Builder.commonRequest(request: Request) =
      apply {
        this.request = request
      }
    
    fun Response.Builder.commonProtocol(protocol: Protocol) =
      apply {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  4. regression-test/src/androidTest/java/okhttp/regression/compare/OkHttpClientTest.java

     */
    @RunWith(AndroidJUnit4.class)
    public class OkHttpClientTest {
      @Test public void get() throws IOException {
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
            .url("https://google.com/robots.txt")
            .build();
        try (Response response = client.newCall(request).execute()) {
          assertEquals(200, response.code());
          assertEquals(Protocol.HTTP_2, response.protocol());
        }
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Nov 14 17:38:22 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  5. samples/guide/src/main/java/okhttp3/recipes/kt/ParseResponseWithMoshi.kt

      private val client = OkHttpClient()
      private val moshi = Moshi.Builder().build()
      private val gistJsonAdapter = moshi.adapter(Gist::class.java)
    
      fun run() {
        val request =
          Request.Builder()
            .url("https://api.github.com/gists/c2a7c39532239ff261be")
            .build()
        client.newCall(request).execute().use { response ->
          if (!response.isSuccessful) throw IOException("Unexpected code $response")
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (1)
  6. samples/guide/src/main/java/okhttp3/recipes/kt/PostPath.kt

      private val fileSystem = FakeFileSystem()
      val path = "test.json".toPath()
    
      fun run() {
        fileSystem.write(path) {
          writeUtf8("{}")
        }
    
        val request =
          Request.Builder()
            .url("https://httpbin.org/anything")
            .put(path.asRequestBody(fileSystem, MEDIA_TYPE_JSON))
            .build()
    
        client.newCall(request).execute().use { response ->
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  7. samples/guide/src/main/java/okhttp3/recipes/CheckHandshake.java

          .addNetworkInterceptor(CHECK_HANDSHAKE_INTERCEPTOR)
          .build();
    
      public void run() throws Exception {
        Request request = new Request.Builder()
            .url("https://publicobject.com/helloworld.txt")
            .build();
    
        try (Response response = client.newCall(request).execute()) {
          if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
    
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Apr 15 14:55:09 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  8. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

      }
    
      public static void main(String... args) throws Exception {
        OkHttpClient client = new OkHttpClient();
    
        // Create request for remote resource.
        Request request = new Request.Builder()
            .url(ENDPOINT)
            .build();
    
        // Execute the request and retrieve the response.
        try (Response response = client.newCall(request).execute()) {
          // Deserialize HTTP response to concrete type.
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Fri Apr 05 03:30:42 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  9. okhttp-brotli/src/test/java/okhttp3/brotli/BrotliBombTest.kt

      @Test
      fun testDecompressBomb() {
        val response =
          Response.Builder()
            .code(200)
            .message("OK")
            .header("Content-Encoding", "br")
            .request(Request.Builder().url("https://example.com/").build())
            .body(readBrotli10G().toResponseBody())
            .protocol(Protocol.HTTP_2)
            .build()
    
        val uncompressed = uncompress(response)
    
        assertFailure {
    Plain Text
    - Registered: Fri Mar 29 11:42:11 GMT 2024
    - Last Modified: Mon Jan 29 22:50:20 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  10. samples/slack/src/main/java/okhttp3/slack/RtmSession.java

        if (webSocket != null) throw new IllegalStateException();
    
        RtmStartResponse rtmStartResponse = slackApi.rtmStart(accessToken);
        webSocket = slackApi.rtm(rtmStartResponse.url, this);
      }
    
      // TODO(jwilson): can I read the response body? Do I have to?
      //                the body from slack is a 0-byte-buffer
      @Override public synchronized void onOpen(WebSocket webSocket, Response response) {
    Java
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Sat Nov 19 20:16:58 GMT 2016
    - 2.4K bytes
    - Viewed (0)
Back to top