Skip to Content
Drash v3 is in beta. APIs may change.

RequestBuilder

import { request } from "@drashland/drash/modules/builders/RequestBuilder.js"; const req = request() .path("http://localhost:1447/users/1") .get() .build();

Returns a RequestBuilder. It exists mainly for tests, where constructing requests by hand gets repetitive.

MethodNotes
path(path)The URL
get()Sets the method to GET
post()Sets the method to POST
put()Sets the method to PUT
patch()Sets the method to PATCH
delete()Sets the method to DELETE
build()Returns a Web Request

There is no method for HEAD, OPTIONS, CONNECT, or TRACE. Construct those with new Request() directly.

Declares no contract at all — it simply has a build() method. See the three things named Builder.

Last updated on