The HTTP Signature for Scale Functions
Field | Type | Description |
---|---|---|
uri | string | The URI of the request. |
method | enum | The HTTP method of the request. |
content_length | uint64 | The length of the request body. |
protocol | enum | The HTTP protocol of the request. |
ip | string | The IP address of the request. |
body | bytes | The request body. |
headers | string_map | The request headers. |
Request(): Request
method. The following are methods that can be used on the returned object.
uri
field is a string
that contains the URI of the request. It can be accessed using the URI(): string
method and
modified using the SetURI(uri: string)
method.
method
field is an enum
that contains the HTTP method of the request. It can be accessed using the Method(): method
method and modified using the SetMethod(method: method)
method.
Valid values for the method
field are:
GET
POST
PUT
PATCH
DELETE
HEAD
OPTIONS
content_length
field is a uint64
that contains the length of the request body. It can be accessed using the
ContentLength(): uint64
method and modified using the SetContentLength(length: uint64)
method.
protocol
field is an enum
that contains the HTTP protocol of the request. It can be accessed using the
Protocol(): protocol
method and modified using the SetProtocol(protocol: protocol)
method.
Valid values for the protocol
field are:
HTTP/1.1
HTTP/2
HTTP/3
ip
field is a string
that contains the IP address of the request. It can be accessed using the IP(): string
method
and modified using the SetIP(ip: string)
method.
body
field is a bytes
that contains the request body. It can be accessed using the Body(): []bytes
method and modified
using the SetBody(body: []bytes)
method.
If you’d like to set the body to a string, you can use the SetBodyString(body: string)
method.
headers
field is a string_map
that contains the request headers. It can be accessed using the Header()
method.
Writing a key to the headers returned by the Header(): header
method can be done using the Set(key: string, value: []string)
method. Reading a key from
the headers returned by the Header(): header
method can be done using the Get(key: string): []string
method.
Field | Type | Description |
---|---|---|
status_code | uint32 | The status code of the response. |
body | bytes | The response body. |
headers | string_map | The response headers. |
Response(): Response
method. The following are methods that can be used on the returned object.
status_code
field is a uint32
that contains the status code of the response. It can be accessed using the
StatusCode(): uint32
method and modified using the SetStatusCode(status_code: uint32)
method.
body
field is a bytes
that contains the response body. It can be accessed using the Body(): []bytes
method and modified
using the SetBody(body: []bytes)
method.
If you’d like to set the body to a string, you can use the SetBodyString(body: string)
method.
headers
field is a string_map
that contains the response headers. It can be accessed using the Header()
method.
Writing a key to the headers returned by the Header(): header
method can be done using the Set(key: string, value: []string)
method. Reading a key from
the headers returned by the Header(): header
method can be done using the Get(key: string): []string
method.