This repository has been archived by the owner on May 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow clients to specify query params in requestData (#139)
Clients can now specify query parameters in the format:- requestData: { '/user': { get: { 200: [longitude: 10, description: 'some description'}] } } } Clients can now add requestData query params to GET requests Clients can now use strings as query param request data
- Loading branch information
Showing
21 changed files
with
478 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use strict'; | ||
var chai = require('chai'); | ||
var request = require('request'); | ||
var expect = chai.expect; | ||
|
||
describe('/user', function() { | ||
describe('post', function() { | ||
it('should respond with 200 OK and some description', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 10 | ||
}, | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
json: {"my-id":2} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(200); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 400 NOT OK', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 'DATA GOES HERE' | ||
}, | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
json: { | ||
latitude: 'DATA GOES HERE' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(400); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 500 SERVER ERROR', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 'DATA GOES HERE' | ||
}, | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
json: { | ||
latitude: 'DATA GOES HERE' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(500); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
var chai = require('chai'); | ||
var request = require('request'); | ||
var expect = chai.expect; | ||
|
||
describe('/user', function() { | ||
describe('get', function() { | ||
it('should respond with 200 OK and some description', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 10 | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(200); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 400 NOT OK', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 'DATA GOES HERE' | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(400); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 500 SERVER ERROR', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
longitude: 'DATA GOES HERE' | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(500); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
var chai = require('chai'); | ||
var request = require('request'); | ||
var expect = chai.expect; | ||
|
||
describe('/user', function() { | ||
describe('get', function() { | ||
it('should respond with 200 OK and some description', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
name: 'Simon' | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(200); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 400 NOT OK', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
name: 'DATA GOES HERE' | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(400); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should respond with 500 SERVER ERROR', function(done) { | ||
request({ | ||
url: 'https://api.uber.com/user', | ||
qs: { | ||
name: 'DATA GOES HERE' | ||
}, | ||
method: 'GET', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}, | ||
function(error, res, body) { | ||
if (error) return done(error); | ||
|
||
expect(res.statusCode).to.equal(500); | ||
|
||
expect(body).to.equal(null); // non-json response or no schema | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
}); |
Oops, something went wrong.