POST action results in "Invalid http header"

オープン
#900 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
api

調査の方向性

まず、C# の getObjects メソッドに示されているリクエストを再現し、動作する curl コマンドと比較します。API に対して、リクエストヘッダーとレスポンスの意図された動作を確認します。GET がヘッダーエラーなしで要求されたメタデータを返せば、issue は完了です。

索引モデルが issue の本文から書いたものです。

説明

I am trying to execute a GET command so I get can get data from a server. The Curl below works in Postman.

$ curl -X GET -H "Authorization: {SESSION_ID}"
https://{server}/api/{version}/metadata/vobjects
While running my code, I am able to get the session ID. The next step is to get the data. But when I execute the GET, I don't get any response. Instead a I get an error as follows: "Specified value has invalid HTTP Header characters. (Parameter 'name')"

Below is the C# code I am trying to execute

_

public static void getObjects(string sessionID)
{
var client = new RestClient("https://generic-server.com/api/v20.3/metadata/vobjects/");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization:", sessionID);
IRestResponse response = client.Execute(request);
Console.WriteLine("Here's the response: " + response.Content + " " + response.Content.Length);
Console.WriteLine("Here's the error message: " + response.ErrorMessage);
}

_

response.ErrorMessage gives the following:

Here's the error message: Specified value has invalid HTTP Header characters. (Parameter 'name')

Note: When I leave the colon out of of the header, then I get the following response from the server:

{"responseStatus":"FAILURE","errors":[{"type":"INVALID_DATA","message":"Invalid http header [Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml]"}]} 190

Does anyone have any thoughts

主要言語
PowerShell
スター
11.2k
フォーク
9.1k
平均マージ
2日 7時間
マージ済み PR(30日)
14

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/sql-server-samples のほかの issue

microsoft/sql-server-samples の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。