httpquest
A wrapper to simplify the fetch API.
Installation
npm install httpquest
Reference
httpRequest
Syntax:
; ;
url
Type: String
A string representing the URL of the request.
method
Type: String
A case-insensitive string representing the method of the request.
'HEAD'
'GET'
'POST'
'PUT'
'PATCH'
'DELETE'
body (depending on method, optional)
Type: Object
An object of either FormData or JSON required for only POST
, PUT
and PATCH
requests which contain the payload data.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'
get
Syntax:
; ;
url
Type: String
A string representing the URL of the request.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'
post
Syntax:
; ;
url
Type: String
A string representing the URL of the request.
body (depending on method, optional)
Type: Object
An object of either FormData or JSON required for only POST
, PUT
and PATCH
requests which contain the payload data.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'
put
Syntax:
; ;
url
Type: String
A string representing the URL of the request.
body (depending on method, optional)
Type: Object
An object of either FormData or JSON required for only POST
, PUT
and PATCH
requests which contain the payload data.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'
patch
Syntax:
; ;
url
Type: String
A string representing the URL of the request.
body (depending on method, optional)
Type: Object
An object of either FormData or JSON required for only POST
, PUT
and PATCH
requests which contain the payload data.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'
delete
Syntax:
; deleteurl options;
url
Type: String
A string representing the URL of the request.
body (depending on method, optional)
Type: Object
An object of either FormData or JSON required for only POST
, PUT
and PATCH
requests which contain the payload data.
options (optional)
Type: Object
An object that contains other paremeters that the Fetch API accepts.
Example:
credentials: 'include' headers: xsrfToken: token params: search: 'dog'