This repository has been archived by the owner on Aug 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
class net.http.Request
BorisNen edited this page Jun 21, 2021
·
2 revisions
Request class to be used with HTTP client.
- Extends - $.web.WebRequest
- SAP Help
https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.net.http.Request.html
- Module
https://github.com/SAP/xsk/tree/main/modules/api/api-xsjs/src/main/resources/xsk/http
- Sample usage:
let http = $.net.http;
let response_prev = require('http/v4/response');
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);
- Coverage
Members | Type | Description | Status |
---|---|---|---|
body | $.web.Body | The body of the request. The value is undefined when there is no body. Only available on $.request. | ✅ |
contentType | string | The content type of the entity. | ✅ |
cookies | $.web.TupelList | The cookies associated with the entity. | ✅ |
entities | $.web.EntityList | The sub-entities of the entity. | ✅ |
headers | $.web.TupelList | The headers of the entity. | ✅ |
language | string | 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 | ✅ |
method | $.net.http | The HTTP method of the incoming HTTP request. Inherited From: $.web.WebRequest#method | ✅ |
parameters | $.web.TupelList | The parameters of the entity. | ✅ |
path | string | Readonly. The URL path specified in the request. | ✅ |
queryPath | string | The URL query path specified in the request. Inherited From: $.web.WebRequest#queryPath | ✅ |
Methods | Return Type | Description | Status |
---|---|---|---|
setBody(body, index(optional)) | void | 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. | ✅ |
- Issues
- Unit Tests
- Integration Tests ❌
✅ - Feature implemented and working as supposed.
❌ - Feature not implemented yet.