-
<inner> batchParser(handler, text, context)
-
Parses a batch response.
Parameters:
Name |
Type |
Description |
handler |
|
This handler. |
text |
String
|
Batch text. |
context |
Object
|
Object with parsing context. |
- Source:
Returns:
An object representation of the batch.
-
<inner> batchSerializer(handler, data, context)
-
Serializes a batch object representation into text.
Parameters:
Name |
Type |
Description |
handler |
|
This handler. |
data |
Object
|
Representation of a batch. |
context |
Object
|
Object with parsing context. |
- Source:
Returns:
An text representation of the batch object; undefined if not applicable.#
-
<inner> createBoundary(prefix) → {String}
-
Creates a string that can be used as a multipart request boundary.
Parameters:
Name |
Type |
Argument |
Description |
prefix |
String
|
<optional>
|
- |
- Source:
Returns:
Boundary string of the format:
--
-
Type
-
String
-
<inner> currentBoundary(context) → {String}
-
Gets the current boundary used for parsing the body of a multipart response.
Parameters:
Name |
Type |
Description |
context |
|
Context used for parsing a multipart response. |
- Source:
Returns:
Boundary string.
-
Type
-
String
-
<inner> hex16() → {String}
-
Calculates a random 16 bit number and returns it in hexadecimal format.
- Source:
Returns:
A 16-bit number in hex format.
-
Type
-
String
-
<inner> partHandler(context)
-
Gets the handler for data serialization of individual requests / responses in a batch.
Parameters:
Name |
Type |
Description |
context |
|
Context used for data serialization. |
- Source:
Returns:
Handler object
-
<inner> readBatch(text, context)
-
Parses a multipart/mixed response body from from the position defined by the context.
Parameters:
Name |
Type |
Description |
text |
String
|
Body of the multipart/mixed response. |
context |
|
Context used for parsing. |
- Source:
Returns:
Array of objects representing the individual responses.
-
-
Parses the http headers in the text from the position defined by the context.
Parameters:
Name |
Type |
Description |
text |
String
|
Text containing an http response's headers |
context |
|
Context used for parsing. |
- Source:
Returns:
Object containing the headers as key value pairs.
This function doesn't support split headers and it will stop reading when it hits two consecutive line breaks.
-
<inner> readLine(text, context) → {String}
-
Returns a substring from the position defined by the context up to the next line break (CRLF).
Parameters:
Name |
Type |
Description |
text |
String
|
Input string. |
context |
|
Context used for reading the input string. |
- Source:
Returns:
Substring to the first ocurrence of a line break or null if none can be found.
-
Type
-
String
-
<inner> readResponse(text, context, delimiter)
-
Parses an HTTP response.
Parameters:
Name |
Type |
Description |
text |
String
|
Text representing the http response. |
context |
|
optional - Context used for parsing. |
delimiter |
String
|
String used as delimiter of the multipart response parts. |
- Source:
Returns:
Object representing the http response.
-
<inner> readTo(text, context, str) → {String}
-
Returns a substring from the position given by the context up to value defined by the str parameter and increments the position in the context.
Parameters:
Name |
Type |
Argument |
Description |
text |
String
|
|
Input string. |
context |
|
|
Context used for reading the input string. |
str |
String
|
<optional>
|
Substring to read up to. |
- Source:
Returns:
Substring to the first ocurrence of str or the end of the input string if str is not specified. Null if the marker is not found.
-
Type
-
String
-
<inner> writeBatch(data, context) → {String}
-
Serializes a batch request object to a string.
Parameters:
Name |
Type |
Description |
data |
|
Batch request object in payload representation format |
context |
|
Context used for the serialization |
- Source:
Returns:
String representing the batch request
-
Type
-
String
-
<inner> writeBatchPart(part, context, nested) → {String}
-
Serializes a part of a batch request to a string. A part can be either a GET request or
a change set grouping several CUD (create, update, delete) requests.
Parameters:
Name |
Type |
Argument |
Description |
part |
|
|
Request or change set object in payload representation format |
context |
|
|
Object containing context information used for the serialization |
nested |
boolean
|
<optional>
|
- |
- Source:
Returns:
String representing the serialized part
A change set is an array of request objects and they cannot be nested inside other change sets.
-
Type
-
String
-
<inner> writeBatchPartDelimiter(boundary, close) → {String}
-
Creates the delimiter that indicates that start or end of an individual request.
Parameters:
Name |
Type |
Description |
boundary |
String
|
Boundary string used to indicate the start of the request |
close |
Boolean
|
Flag indicating that a close delimiter string should be generated |
- Source:
Returns:
Delimiter string
-
Type
-
String
-
<inner> writeRequest(request) → {String}
-
Serializes a request object to a string.
Parameters:
Name |
Type |
Description |
request |
|
Request object to serialize |
- Source:
Returns:
String representing the serialized request
-
Type
-
String