Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 1533845

Browse files
committed
Update http-fake-backend to v3.0.7
1 parent c6be55b commit 1533845

File tree

2 files changed

+58
-6
lines changed

2 files changed

+58
-6
lines changed

generators/app/templates/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-fake-backend",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.",
55
"license": "MIT",
66
"main": "index.js",
@@ -22,10 +22,10 @@
2222
"boom": "^4.0.0",
2323
"confidence": "^3.x.x",
2424
"dotenv": "^2.0.0",
25-
"glue": "^3.x.x",
25+
"glue": "^4.x.x",
2626
"good": "^7.0.2",
2727
"good-console": "^6.1.2",
28-
"good-squeeze": "^4.0.0",
28+
"good-squeeze": "^5.0.0",
2929
"handlebars": "^4.0.5",
3030
"hapi": "^15.x.x",
3131
"inert": "^4.0.2",
@@ -35,8 +35,8 @@
3535
},
3636
"devDependencies": {
3737
"code": "^3.0.2",
38-
"coveralls": "^2.11.12",
39-
"eslint": "^3.4.0",
38+
"coveralls": "^2.11.13",
39+
"eslint": "^3.5.0",
4040
"eslint-config-hapi": "^10.0.0",
4141
"eslint-plugin-hapi": "^4.0.0",
4242
"lab": "^11.x.x",

generators/app/templates/test/server/api/endpoint.js

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ const Endpoint = SetupEndpoint({
4949
method: 'DELETE',
5050
response: '/test/server/api/fixtures/response.json'
5151
}]
52+
},
53+
{
54+
params: '/multipleMethods',
55+
requests: [{
56+
method: ['PUT', 'PATCH'],
57+
response: {
58+
success: true
59+
}
60+
}]
5261
}
5362
]
5463
});
@@ -100,7 +109,7 @@ lab.experiment('Setup endpoints', () => {
100109
lab.test('returns 405: Method Not Allowed for undefined methods', (done) => {
101110

102111
request = {
103-
method: 'post',
112+
method: 'POST',
104113
url: apiUrlPrefix + '/endpoint/read'
105114
};
106115

@@ -212,4 +221,47 @@ lab.experiment('Setup endpoints', () => {
212221
});
213222
});
214223

224+
lab.test('correct json for multiple Methods', (done) => {
225+
226+
const putRequest = {
227+
method: 'PUT',
228+
url: apiUrlPrefix + '/endpoint/multipleMethods'
229+
};
230+
231+
const patchRequest = {
232+
method: 'PATCH',
233+
url: apiUrlPrefix + '/endpoint/multipleMethods'
234+
};
235+
236+
const postRequest = {
237+
method: 'POST',
238+
url: apiUrlPrefix + '/endpoint/multipleMethods'
239+
};
240+
241+
server.inject(putRequest, (response) => {
242+
243+
Code.expect(response.statusCode).to.equal(200);
244+
Code.expect(response.result).to.equal({ success: true });
245+
});
246+
247+
server.inject(patchRequest, (response) => {
248+
249+
Code.expect(response.statusCode).to.equal(200);
250+
Code.expect(response.result).to.equal({ success: true });
251+
});
252+
253+
server.inject(postRequest, (response) => {
254+
255+
Code.expect(response.statusCode).to.equal(405);
256+
Code.expect(response.result).to.equal({
257+
statusCode: 405,
258+
error: 'Method Not Allowed'
259+
});
260+
261+
done();
262+
});
263+
264+
265+
});
266+
215267
});

0 commit comments

Comments
 (0)