Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 90 for toText (0.16 sec)

  1. okhttp/src/test/java/okhttp3/internal/ws/WebSocketWriterTest.kt

        serverWriter.writeMessageFrame(OPCODE_TEXT, "Hello".encodeUtf8())
        assertData("810548656c6c6f")
      }
    
      @Test fun serverCompressedTextMessage() {
        val serverWriter =
          WebSocketWriter(
            false,
            data,
            random,
            true,
            false,
            0L,
          )
        serverWriter.writeMessageFrame(OPCODE_TEXT, "Hello".encodeUtf8())
        assertData("c107f248cdc9c90700")
      }
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  2. samples/static-server/src/main/java/okhttp3/sample/SampleServer.java

          return new MockResponse()
              .setStatus("HTTP/1.1 404")
              .addHeader("content-type: text/plain; charset=utf-8")
              .setBody("NOT FOUND: " + path);
        } catch (IOException e) {
          return new MockResponse()
              .setStatus("HTTP/1.1 500")
              .addHeader("content-type: text/plain; charset=utf-8")
              .setBody("SERVER ERROR: " + e);
        }
      }
    
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Jan 02 02:50:44 GMT 2019
    - 4.7K bytes
    - Viewed (0)
  3. okhttp-logging-interceptor/src/main/kotlin/okhttp3/logging/HttpLoggingInterceptor.kt

           *
           * Example:
           * ```
           * --> POST /greeting http/1.1
           * Host: example.com
           * Content-Type: plain/text
           * Content-Length: 3
           * --> END POST
           *
           * <-- 200 OK (22ms)
           * Content-Type: plain/text
           * Content-Length: 6
           * <-- END HTTP
           * ```
           */
          HEADERS,
    
          /**
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 09:14:38 GMT 2024
    - 11.2K bytes
    - Viewed (1)
  4. samples/compare/src/test/kotlin/okhttp3/compare/ApacheHttpClientTest.kt

        request.addHeader("Accept", "text/plain")
    
        httpClient.execute(request).use { response ->
          assertThat(response.code).isEqualTo(200)
          assertThat(EntityUtils.toString(response.entity)).isEqualTo("hello, Apache HttpClient 5.x")
        }
    
        val recorded = server.takeRequest()
        assertThat(recorded.headers["Accept"]).isEqualTo("text/plain")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  5. okhttp/src/test/java/okhttp3/ResponseBodyJvmTest.kt

        body.byteStream().close()
        assertThat(closed.get()).isTrue()
      }
    
      @Test
      fun unicodeTextWithUnsupportedEncoding() {
        val text = "eile oli oliiviõli"
        val body = text.toResponseBody("text/plain; charset=unknown".toMediaType())
        assertThat(body.string()).isEqualTo(text)
      }
    
      companion object {
        @JvmOverloads
        fun body(
          hex: String,
          charset: String? = null,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 13K bytes
    - Viewed (0)
  6. samples/compare/src/test/kotlin/okhttp3/compare/JavaHttpClientTest.kt

            .header("Accept", "text/plain")
            .build()
    
        val response = httpClient.send(request, BodyHandlers.ofString())
        assertThat(response.statusCode()).isEqualTo(200)
        assertThat(response.body()).isEqualTo("hello, Java HTTP Client")
    
        val recorded = server.takeRequest()
        assertThat(recorded.headers["Accept"]).isEqualTo("text/plain")
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.7K bytes
    - Viewed (0)
  7. okhttp-sse/src/main/kotlin/okhttp3/sse/EventSources.kt

        return EventSource.Factory { request, listener ->
          val actualRequest =
            if (request.header("Accept") == null) {
              request.newBuilder().addHeader("Accept", "text/event-stream").build()
            } else {
              request
            }
    
          RealEventSource(actualRequest, listener).apply {
            connect(callFactory)
          }
        }
      }
    
      @JvmStatic
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat Apr 06 04:18:15 GMT 2024
    - 1.6K bytes
    - Viewed (1)
  8. samples/guide/src/main/java/okhttp3/recipes/PostFile.java

    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    
    public final class PostFile {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        File file = new File("README.md");
    
        Request request = new Request.Builder()
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sat May 25 18:02:55 GMT 2019
    - 1.5K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/PostStreaming.java

    import okhttp3.Request;
    import okhttp3.RequestBody;
    import okhttp3.Response;
    import okio.BufferedSink;
    
    public final class PostStreaming {
      public static final MediaType MEDIA_TYPE_MARKDOWN
          = MediaType.get("text/x-markdown; charset=utf-8");
    
      private final OkHttpClient client = new OkHttpClient();
    
      public void run() throws Exception {
        RequestBody requestBody = new RequestBody() {
    Java
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Fri Jul 06 03:18:15 GMT 2018
    - 2.1K bytes
    - Viewed (0)
  10. okhttp/src/test/java/okhttp3/RequestBodyTest.kt

          assertThat(requestBody.contentType()).isNull()
        }
      }
    
      @Test
      fun testFileDescriptorMediaType() {
        assertOnFileDescriptor { fd ->
          val contentType = "text/plain".toMediaType()
    
          val requestBody = fd.toRequestBody(contentType)
    
          assertThat(requestBody.contentType()).isEqualTo(contentType)
        }
      }
    
      @Test
      fun testFileDescriptorReadTwice() {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
Back to top