Closed rotovibe closed 8 years ago
Hey @rotovibe! Thanks for raising this.
Can you show me the request you're making?
On 25 Oct 2016 19:39, "rotovibe" notifications@github.com wrote:
In the example wiki, this snippet is causing a 404 when GETting the resource:
interfake.createRoute({ request: { url: '/whats-next', method: 'get', query: { // Optional querystring parameters page: 2 } }, response: { code: 200, // HTTP Status Code delay: 50, // Delay in milliseconds body: { // JSON Body Response next:'more stuff' }, headers: { // Optional headers 'X-Powered-By': 'Interfake' } } });
It seems to work when I take the query property out of the request graph.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/basicallydan/interfake/issues/46, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfg5QfvYAHkRS3X8NSv9J3Jpg9Kyw_Xks5q3kzWgaJpZM4KgVja .
http://localhost:3000/whats-next I get a 404. I took out the query property in the request route definition json and it seemed to work fine.
I also noticed this issue...I still have the query property excluded in the request defintion. But when I add a querystring... http://localhost:3000/whats-next/?page=2 and http://localhost:3000/whats-next?page=2 I get a 404 as well.
thanks for looking into it.
Hey @rotovibe – all of this is by design. Interfake is pretty strict about endpoint definitions. So in your request definition, if the querystring is there you need to include it in your request. If it's not, you should not include it.
Here's an example.
interfake.createRoute({
request: {
url: '/whats-next',
method: 'get',
query: { // Optional querystring parameters
page: 2
}
},
...
For the above request, you must use /whats-next?page=2
to get a response.
Is this against your expectations? Is the reason for your confusion the comment // Optional querystring parameters
?
Perfect. Thanks for the info @basicallydan . Makes sense.
Cheers @rotovibe, no problem 👍
In the example wiki, this snippet is causing a 404 when GETting the resource:
interfake.createRoute({ request: { url: '/whats-next', method: 'get', query: { // Optional querystring parameters page: 2 } }, response: { code: 200, // HTTP Status Code delay: 50, // Delay in milliseconds body: { // JSON Body Response next:'more stuff' }, headers: { // Optional headers 'X-Powered-By': 'Interfake' } } });
It seems to work when I take the query property out of the request graph.