Revisions
-
Siddhant Sinha revised this gist
Aug 24, 2017 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,12 @@ To send a request via the sandbox, you can use pm.sendRequest. ``` pm.test("Status code is 200", function () { pm.sendRequest('https://postman-echo.com/get', function (err, res) { pm.expect(err).to.not.be.ok; pm.expect(res).to.have.property('code', 200); pm.expect(res).to.have.property('status', 'OK'); }); }); ``` -
Siddhant Sinha renamed this gist
Aug 23, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Siddhant Sinha renamed this gist
Aug 23, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Siddhant Sinha created this gist
Aug 23, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ To send a request via the sandbox, you can use pm.sendRequest. ``` pm.sendRequest('https://postman-echo.com/get', function (err, res) { pm.expect(err).to.not.be.ok; pm.expect(res).to.have.property('code', 200); pm.expect(res).to.have.property('status', 'OK'); }); ``` Without additional options, this will sent a GET request to the URL specified. If you prefer to be more explicit, you can use the complete syntax: ``` pm.sendRequest({ url: 'https://postman-echo.com/post', method: 'POST', header: 'headername1:value1', body: { mode: 'raw', raw: JSON.stringify({ key: "this is json" }) } }, function (err, res) { console.log(res); }); ```