Specifying Standard and Custom Headers
-
The standard headers can be specified using the corresponding custom operation names.
- Example:
AuthorizationBearer
(a shortcur for the "Authorization" header with the "Bearer" scheme) - Example:
Accept
- Example:
UserAgent
- Example:
-
Custom headers can be specified using the
header
function.- Example:
header "X-GitHub-Api-Version" "2022-11-28"
- Example:
Here's an example that fetches the issues of the vide-collabo/vide repository on GitHub:
http {
GET "https://api.github.com/repos/vide-collabo/vide/issues"
AuthorizationBearer "**************"
Accept "application/vnd.github.v3+json"
UserAgent "FsHttp"
header "X-GitHub-Api-Version" "2022-11-28"
}
|> Request.send
namespace FsHttp
Multiple items
static member HttpBuilder.http: HeaderContext
--------------------
property HttpBuilder.http: HeaderContext with get
static member HttpBuilder.http: HeaderContext
--------------------
property HttpBuilder.http: HeaderContext with get
custom operation: GET (string)
Calls IRequestContext.Get
custom operation: AuthorizationBearer (string)
Calls IRequestContext.AuthorizationBearer
<summary> Authorization header using Bearer authorization token </summary>
<summary> Authorization header using Bearer authorization token </summary>
custom operation: Accept (string)
Calls IRequestContext.Accept
<summary> Content-Types that are acceptable for the response </summary>
<summary> Content-Types that are acceptable for the response </summary>
custom operation: UserAgent (string)
Calls IRequestContext.UserAgent
<summary> The user agent string of the user agent </summary>
<summary> The user agent string of the user agent </summary>
custom operation: header (string) (string)
Calls IRequestContext.Header
<summary> Custom header </summary>
<summary> Custom header </summary>
Multiple items
module Request from FsHttp.Print
--------------------
module Request from FsHttp
--------------------
type Request = { header: Header content: BodyContent config: Config printHint: PrintHint }
module Request from FsHttp.Print
--------------------
module Request from FsHttp
--------------------
type Request = { header: Header content: BodyContent config: Config printHint: PrintHint }
val send: request: IToRequest -> Response
<summary> Sends a request synchronously. </summary>
<summary> Sends a request synchronously. </summary>