Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 110 for Content (0.16 sec)

  1. okhttp-sse/src/test/java/okhttp3/sse/internal/EventSourceHttpTest.kt

            .body(
              """
              |data: hey
              |
              |
              """.trimMargin(),
            ).setHeader("content-type", "text/plain")
            .build(),
        )
        newEventSource()
        listener.assertFailure("Invalid content-type: text/plain")
      }
    
      @Test
      fun badResponseCode() {
        server.enqueue(
          MockResponse.Builder()
            .body(
              """
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Jan 14 10:20:09 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/CacheTest.kt

        assertThat(cache.hitCount()).isEqualTo(0)
      }
    
      private fun corruptCertificate(cacheEntry: Path) {
        var content = fileSystem.source(cacheEntry).buffer().readUtf8()
        content = content.replace("MII", "!!!")
        fileSystem.sink(cacheEntry).buffer().writeUtf8(content).close()
      }
    
      @Test
      fun responseCachingAndRedirects() {
        server.enqueue(
          MockResponse.Builder()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Wed Apr 10 19:46:48 GMT 2024
    - 108.6K bytes
    - Viewed (0)
  3. samples/guide/src/main/java/okhttp3/recipes/kt/ParseResponseWithMoshi.kt

          for ((key, value) in gist!!.files!!) {
            println(key)
            println(value.content)
          }
        }
      }
    
      @JsonClass(generateAdapter = true)
      data class Gist(var files: Map<String, GistFile>?)
    
      @JsonClass(generateAdapter = true)
      data class GistFile(var content: String?)
    }
    
    fun main() {
      ParseResponseWithMoshi().run()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 1.6K bytes
    - Viewed (1)
  4. okhttp/src/main/kotlin/okhttp3/internal/-ResponseBodyCommon.kt

      val contentLength = contentLength()
      if (contentLength > Int.MAX_VALUE) {
        throw IOException("Cannot buffer entire body for content length: $contentLength")
      }
    
      val bytes = source().use(consumer)
      val size = sizeMapper(bytes)
      if (contentLength != -1L && contentLength != size.toLong()) {
        throw IOException("Content-Length ($contentLength) and stream length ($size) disagree")
      }
      return bytes
    }
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  5. okhttp/src/main/kotlin/okhttp3/internal/cache/CacheStrategy.kt

        ): Boolean {
          // Always go to network for uncacheable response codes (RFC 7231 section 6.1), This
          // implementation doesn't support caching partial content.
          when (response.code) {
            HTTP_OK,
            HTTP_NOT_AUTHORITATIVE,
            HTTP_NO_CONTENT,
            HTTP_MULT_CHOICE,
            HTTP_MOVED_PERM,
            HTTP_NOT_FOUND,
            HTTP_BAD_METHOD,
            HTTP_GONE,
            HTTP_REQ_TOO_LONG,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Apr 15 13:24:48 GMT 2024
    - 12K bytes
    - Viewed (0)
  6. okhttp-brotli/src/test/java/okhttp3/brotli/BrotliBombTest.kt

    class BrotliBombTest {
      /** https://github.com/square/okhttp/issues/7738 */
      @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()
    
    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)
  7. okhttp-sse/src/main/kotlin/okhttp3/sse/internal/RealEventSource.kt

            return
          }
    
          val body = response.body
    
          if (!body.isEventStream()) {
            listener.onFailure(
              this,
              IllegalStateException("Invalid content-type: ${body.contentType()}"),
              response,
            )
            return
          }
    
          // This is a long-lived response. Cancel full-call timeouts.
          call?.timeout()?.cancel()
    
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  8. mockwebserver/src/main/kotlin/mockwebserver3/MockWebServer.kt

          return reuseSocket
        }
      }
    
      @Throws(Exception::class)
      private fun processHandshakeFailure(raw: Socket) {
        val context = SSLContext.getInstance("TLS")
        context.init(null, arrayOf<TrustManager>(UNTRUSTED_TRUST_MANAGER), SecureRandom())
        val sslSocketFactory = context.socketFactory
        val socket =
          sslSocketFactory.createSocket(
            raw,
            raw.inetAddress.hostAddress,
            raw.port,
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Sun Mar 31 17:16:15 GMT 2024
    - 37.4K bytes
    - Viewed (0)
  9. okhttp/src/main/kotlin/okhttp3/internal/http/BridgeInterceptor.kt

        if (body != null) {
          val contentType = body.contentType()
          if (contentType != null) {
            requestBuilder.header("Content-Type", contentType.toString())
          }
    
          val contentLength = body.contentLength()
          if (contentLength != -1L) {
            requestBuilder.header("Content-Length", contentLength.toString())
            requestBuilder.removeHeader("Transfer-Encoding")
          } else {
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.2K bytes
    - Viewed (2)
  10. okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der/DerWriter.kt

        tagClass: Int,
        tag: Long,
        block: (BufferedSink) -> Unit,
      ) {
        val constructedBit: Int
        val content = Buffer()
    
        stack.add(content)
        constructed = false // The enclosed object written in block() is not constructed.
        path += name
        try {
          block(content)
          constructedBit = if (constructed) 0b0010_0000 else 0
          constructed = true // The enclosing object is constructed.
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 5.7K bytes
    - Viewed (0)
Back to top