necessary 15.0.1 → 15.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,12 +80,13 @@ See below.
|
|
|
80
80
|
|
|
81
81
|
The first two `get()` and `post()` functions make use of the third `request()` function, which is more generic and can be used for arbitrary HTTP requests.
|
|
82
82
|
|
|
83
|
-
* The `get()` function sends a `GET` request, taking `host`, `uri` and `query` arguments, together with
|
|
83
|
+
* The `get()` function sends a `GET` request, taking `host`, `uri` and `query` arguments, together with optional `headers` and `responseType` arguments after the `query` argument.
|
|
84
84
|
|
|
85
85
|
The `query` argument should be a plain old JavaScript object, the names and values of which are encoded and concatenated to form the query string.
|
|
86
86
|
|
|
87
87
|
The `headers` argument should also be a plain old JavaScript object.
|
|
88
88
|
If it does not have an `accept` property then one wil be provided with the value `application/json`.
|
|
89
|
+
The `reponseType` argument can be left null, which is the default, or set to a value such as `arraybuffer`.
|
|
89
90
|
|
|
90
91
|
The `callback` argument is expected to be a function taking `content` and `statusCode` arguments.
|
|
91
92
|
If the `accept` property of the main `headers` argument is set to `application/json` then the function's `content` argument can be assumed to be JSON, or `null` if the request body cannot be parsed as such.
|
|
@@ -110,7 +111,7 @@ Note that the `uri` argument must include a leading forward slash `/` since the
|
|
|
110
111
|
* The `post()` function behaves almost identically to the `get()` function, with the following differences.
|
|
111
112
|
|
|
112
113
|
It sends a `POST` rather than a `GET` request.
|
|
113
|
-
There is an additional `content` argument that comes before the `headers`
|
|
114
|
+
There is an additional `content` argument that comes before the `headers` and `reponseType` arguments, which are again optional.
|
|
114
115
|
If the `headers` argument does not have a `content-type` property then one will be provided with the value of `application/json`.
|
|
115
116
|
If the `content-type` property of the `headers` argument is set to `application/json` then the `content` argument is assumed to be a plain old JavaScript object and is stringified as JSON.
|
|
116
117
|
|
|
@@ -131,7 +132,7 @@ post(host, uri, query, json, (json, statusCode) => {
|
|
|
131
132
|
});
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
* The `request()` function behaves similarly to the `post()` function but the `headers`
|
|
135
|
+
* The `request()` function behaves similarly to the `post()` function but the `headers` and `respnoseType` argumenta are no longer optional and there is a `method` argument that comes before the `content` argument:
|
|
135
136
|
|
|
136
137
|
```
|
|
137
138
|
const host = "...",
|