1

現在、json を UTF-32 エンコーディング形式で送信する必要がある API を使用しています。

私はHttpClientlibを使用していますが、Fiddlerのようにjsonをエンコードしないため、サーバーはエラーを返します。私は何時間もグーグルで検索しましたが、成功しませんでした。とにかく、ここに私の生のリクエストがあります(フィドラー):

POST http://example.com/ HTTP/1.1
Content-Type: application/json; charset=utf-32
Host: example.com
Content-Length: 92
Expect: 100-continue
Connection: Keep-Alive

{"jsonKey":"JsonValue"}

エンコードされたコンテンツは次のようになります。

ここに画像の説明を入力

これが私の単純な C# リクエストです。

using(HttpClient client = new HttpClient(new HttpClientHandler() { Proxy = new WebProxy("127.0.0.1:8080") }))
{
    _ = await client.PostAsync("http://example.com", new StringContent("{\"jsonKey\":\"JsonValue\"}", Encoding.UTF32, "application/json")).ConfigureAwait(false);
}

C# の内容は次のようになります。

ここに画像の説明を入力

4

0 に答える 0