mpx-api 1.0.1 → 1.0.2
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/package.json +3 -3
- package/src/lib/http-client.js +9 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mpx-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Developer-first API testing, mocking, and documentation CLI",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mpx-api": "
|
|
7
|
+
"mpx-api": "bin/mpx-api.js"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"api",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/mesaplexdev/mpx-api.git"
|
|
25
|
+
"url": "git+https://github.com/mesaplexdev/mpx-api.git"
|
|
26
26
|
},
|
|
27
27
|
"bugs": {
|
|
28
28
|
"url": "https://github.com/mesaplexdev/mpx-api/issues"
|
package/src/lib/http-client.js
CHANGED
|
@@ -38,9 +38,17 @@ export class HttpClient {
|
|
|
38
38
|
async request(method, url, options = {}) {
|
|
39
39
|
const startTime = Date.now();
|
|
40
40
|
|
|
41
|
+
// Set default User-Agent, allow override via options.headers
|
|
42
|
+
const defaultHeaders = {
|
|
43
|
+
'user-agent': 'mpx-api/1.0.1',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Merge headers, with user headers taking precedence
|
|
47
|
+
const headers = { ...defaultHeaders, ...(options.headers || {}) };
|
|
48
|
+
|
|
41
49
|
const requestOptions = {
|
|
42
50
|
method: method.toUpperCase(),
|
|
43
|
-
headers
|
|
51
|
+
headers,
|
|
44
52
|
body: options.body,
|
|
45
53
|
};
|
|
46
54
|
|