Skip to main content
Latest
class RequestContext
Re-export
import { RequestContext } from "https://deno.land/x/periskope_maytapi_deno@v1.4.0/index.ts";

Represents an HTTP request context

Constructors

new
RequestContext(url: string, httpMethod: HttpMethod)

Creates the request context using a http method and request resource url

Properties

private
body: RequestBody
private
headers: { [key: string]: string; }
private
url: URL

Methods

addCookie(name: string, value: string): void

Sets a cookie with the name and value. NO check for duplicate cookies is performed

getHeaders(): { [key: string]: string; }
getUrl(): string

Sets the body of the http request either as a string or FormData

Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE request is discouraged. https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1

setHeaderParam(key: string, value: string): void
setQueryParam(name: string, value: string)
setUrl(url: string)

Replaces the url set in the constructor with this url.