Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 23 for json (0.14 sec)

  1. okhttp/src/test/java/okhttp3/WebPlatformToAsciiData.kt

    package okhttp3
    
    import kotlinx.serialization.Serializable
    import kotlinx.serialization.decodeFromString
    import kotlinx.serialization.json.Json
    
    /**
     * A test from the [Web Platform To ASCII](https://github.com/web-platform-tests/wpt/blob/master/url/resources/toascii.json).
     *
     * Each test is a line of the file `toascii.json`.
     */
    @Serializable
    class WebPlatformToAsciiData {
      var input: String? = null
      var output: String? = null
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  2. okhttp-hpacktests/src/test/java/okhttp3/internal/http2/hpackjson/HpackJsonUtil.kt

              @FromJson fun byteStringFromJson(json: String) = json.decodeHex()
            },
          )
          .add(KotlinJsonAdapterFactory())
          .build()
      private val STORY_JSON_ADAPTER = MOSHI.adapter(Story::class.java)
    
      private val fileSystem = FileSystem.SYSTEM
    
      private fun readStory(source: BufferedSource): Story {
        return STORY_JSON_ADAPTER.fromJson(source)!!
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  3. README.md

    ----------------
    
    This program posts data to a service. [Full source][post_example].
    
    ```java
    public static final MediaType JSON = MediaType.get("application/json");
    
    OkHttpClient client = new OkHttpClient();
    
    String post(String url, String json) throws IOException {
      RequestBody body = RequestBody.create(json, JSON);
      Request request = new Request.Builder()
          .url(url)
          .post(body)
          .build();
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Wed Dec 20 23:27:07 GMT 2023
    - 6.2K bytes
    - Viewed (0)
  4. samples/guide/src/main/java/okhttp3/recipes/kt/PostPath.kt

      private val client = OkHttpClient()
      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)
  5. samples/simple-client/src/main/java/okhttp3/sample/OkHttpContributors.java

      private static final String ENDPOINT = "https://api.github.com/repos/square/okhttp/contributors";
      private static final Moshi MOSHI = new Moshi.Builder().build();
      private static final JsonAdapter<List<Contributor>> CONTRIBUTORS_JSON_ADAPTER = MOSHI.adapter(
          Types.newParameterizedType(List.class, Contributor.class));
    
      static class Contributor {
        String login;
        int contributions;
      }
    
    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)
  6. okhttp/src/test/java/okhttp3/WebPlatformUrlTestData.kt

    import okhttp3.internal.format
    import okio.Buffer
    import okio.BufferedSource
    
    /**
     * A test from the [Web Platform URL test suite](https://github.com/web-platform-tests/wpt/blob/master/url/resources/urltestdata.json).
     *
     * Each test is a line of the file `urltestdata.txt`. The format is informally specified by its
     * JavaScript parser `urltestparser.js` with which this class attempts to be compatible.
     *
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.7K bytes
    - Viewed (0)
  7. okhttp/src/test/java/okhttp3/RequestTest.kt

        assertThat(bodyToHex(body), "Retransmit body").isEqualTo("616263")
      }
    
      /** Common verbs used for apis such as GitHub, AWS, and Google Cloud.  */
      @Test
      fun crudVerbs() {
        val contentType = "application/json".toMediaType()
        val body = "{}".toRequestBody(contentType)
    
        val get = Request.Builder().url("http://localhost/api").get().build()
        assertThat(get.method).isEqualTo("GET")
        assertThat(get.body).isNull()
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 16.4K bytes
    - Viewed (0)
  8. okhttp/build.gradle.kts

      testImplementation(libs.kotlin.test.annotations)
      testImplementation(libs.kotlin.test.common)
      testImplementation(libs.kotlinx.serialization.core)
      testImplementation(libs.kotlinx.serialization.json)
      testImplementation(projects.okhttpJavaNetCookiejar)
      testImplementation(projects.okhttpTls)
      testImplementation(projects.okhttpUrlconnection)
      testImplementation(projects.mockwebserver3)
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Jan 04 05:32:07 GMT 2024
    - 5.6K bytes
    - Viewed (0)
  9. samples/guide/src/main/java/okhttp3/recipes/kt/AccessHeaders.kt

          Request.Builder()
            .url("https://api.github.com/repos/square/okhttp/issues")
            .header("User-Agent", "OkHttp Headers.java")
            .addHeader("Accept", "application/json; q=0.5")
            .addHeader("Accept", "application/vnd.github.v3+json")
            .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.4K bytes
    - Viewed (0)
  10. okcurl/src/test/kotlin/okhttp3/curl/MainTest.kt

            "-d",
            "foo",
            "-H",
            "Content-Type: application/json",
            "http://example.com",
          ).createRequest()
        val body = request.body
        assertThat(request.method).isEqualTo("POST")
        assertThat(request.url.toString()).isEqualTo("http://example.com/")
        assertThat(body!!.contentType().toString())
          .isEqualTo("application/json; charset=utf-8")
        assertThat(bodyAsString(body)).isEqualTo("foo")
      }
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 4.3K bytes
    - Viewed (0)
Back to top