Skip to content

Documentation / @warp-drive/holodeck / mock / GET

Function: GET()

ts
function GET(
   owner, 
   url, 
   response, 
options?): Promise<void>;

Defined in: mock.ts:43

Sets up Mocking for a GET request on the mock server for the supplied url.

The response body is generated by the supplied response function.

Available options:

  • status: the status code to return (default: 200)
  • headers: the headers to return (default: {})
  • body: the body to match against for the request (default: null)
  • RECORD: whether to record the request (default: false)

Parameters

owner

object

url

string

the url to mock, relative to the mock server host (e.g. users/1)

response

ResponseGenerator

a function which generates the response to return

options?

Partial<Omit<Scaffold, "response" | "url" | "method">> & object

status, headers for the response, body to match against for the request, and whether to record the request

Returns

Promise<void>

Released under the MIT License.