tr-apisrv 0.1.2 → 0.1.5
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/index.js +4 -3
- package/package.json +2 -2
- package/test/test.js +1 -0
package/index.js
CHANGED
|
@@ -144,8 +144,9 @@ var ApiSrv = function(opts) {
|
|
|
144
144
|
}
|
|
145
145
|
switch (req.method) {
|
|
146
146
|
case 'POST':
|
|
147
|
+
case 'PUT':
|
|
147
148
|
if (req.url.match(/\?/)) {
|
|
148
|
-
error(res, 400, 'URL for POST must not contain query parameters.');
|
|
149
|
+
error(res, 400, 'URL for POST or PUT must not contain query parameters.');
|
|
149
150
|
return;
|
|
150
151
|
}
|
|
151
152
|
r.url = req.url;
|
|
@@ -177,7 +178,7 @@ var ApiSrv = function(opts) {
|
|
|
177
178
|
// RFC6749 anyways says that application/x-www-form-urlencoded
|
|
178
179
|
// is the "correct" way to go.
|
|
179
180
|
default:
|
|
180
|
-
error(res, 400, 'POST body must be in JSON or www-form-urlencoded format.');
|
|
181
|
+
error(res, 400, 'POST or PUT body must be in JSON or www-form-urlencoded format.');
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
184
|
break;
|
|
@@ -201,7 +202,7 @@ var ApiSrv = function(opts) {
|
|
|
201
202
|
r.method = req.method;
|
|
202
203
|
break;
|
|
203
204
|
default:
|
|
204
|
-
error(res, 405, 'Only GET, POST, and DELETE are allowed.');
|
|
205
|
+
error(res, 405, 'Only GET, POST, PUT, and DELETE are allowed.');
|
|
205
206
|
return;
|
|
206
207
|
}
|
|
207
208
|
r.headers = req.headers;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tr-apisrv",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "A simple asynchronous API server class",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "node ./test/test.js"
|
|
8
8
|
},
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=10.
|
|
10
|
+
"node": ">=10.0.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
},
|
package/test/test.js
CHANGED