createTextRequest()function

createTextRequest(method: RequestMethod, url: PossibleURL, body: string, options: RequestOptions = {}, caller: AnyCaller = createTextRequest): Request
ParamType
methodRequestMethod
The HTTP method. required
urlPossibleURL
The target URL. required
bodystring
The plain-text request body. required
optionsRequestOptions
Additional request options. Defaults to {}
callerAnyCaller
Function to attribute a thrown error to (defaults to createTextRequest). Defaults to createTextRequest
Return
Request
A Request with text/plain content type.

Create a plain-text Request.

  • HEAD and GET requests never send a body.

Examples

createTextRequest("POST", "https://api.example.com/items", "hello")