Skip to content

$.net.http.Request

$.net.http.Request class to be used with HTTP client. It extends $.web.WebRequest.

Overview

Sample Usage

let http = $.net.http;

let dest = http.readDestination("Demo", "service");
// create client
let client = new http.Client();
// create Request class with the HTTP method constants as a first argument and the path of the resource as a second
let request = new http.Request(http.GET, "/"); // new Request(METHOD, PATH)
// the PATH will be prefixed by destination's pathPrefix, e.g. "/search?" on the request

// Use the Request class to send an http request with the net.http.Client class
client.request(request, dest);

Properties

Name Description Type
body The body of the request. The value is undefined when there is no body. Only available on $.request. $.web.Body
contentType The content type of the entity. string
cookies The cookies associated with the entity. $.web.TupelList
entities The sub-entities of the entity. $.web.EntityList
headers The headers of the entity. $.web.TupelList
language Readonly. Language of the request in IETF (BCP 47) format. This property contains the language that is used for the request. Application code should rely on this property only. The value is a string in the format specified by the IETF (BCP 47) standard. Inherited From: $.web.WebRequest#language string
method The HTTP method of the incoming HTTP request. Inherited From: $.web.WebRequest#method $.net.http
parameters The parameters of the entity. $.web.TupelList
path Readonly. The URL path specified in the request. string
queryPath The URL query path specified in the request. Inherited From: $.web.WebRequest#queryPath string

Functions

Function Description Returns
setBody(body, index(optional)) Sets the body of the entity; the method supports all elemental JavaScript types and ArrayBuffers as a body and numbers as an index. Throws an error if the parameters are invalid. void