Added Node-Js SuperAgent Code Generator
What it does? Fixes (https://github.com/postmanlabs/postman-app-support/issues/6331) Adds support for Node-Js SuperAgent CodeGenerator in the project.
What changes you made?
There are no changes to the core structure of the project. I have only added one more codegen directory. The README is updated to include the NodeJs-SuperAgent Support. Other than that there are no changes to any file outside the codegen/nodejs-superagent directory.
Would appreciate a review by the maintainers, @umeshp7 @shreys7
Let me know if I've missed anything.
Any updates on this? @umeshp7 @shreys7
Would appreciate a review 😊
Hey @ajwad-shaikh , could you post some example snippets generated for a GET and POST request?
Sure @shreys7! I have compiled a few results that the generator returns for the newman tests
- Request Headers
var superagent = require('superagent');
superagent
.get('https://postman-echo.com/headers')
.set({
'my-sample-header': 'Lorem ipsum dolor sit amet',
'testing': '\'singlequotes\'',
'TEST': '"doublequotes"',
'Content-Type': 'text/plain'
})
.end(function (error, response) {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
- POST json with raw
var superagent = require('superagent');
superagent
.post('https://postman-echo.com/post')
.set({
'Content-Type': 'application/json'
})
.send(JSON.stringify({"json":"Test-Test"}))
.end(function (error, response) {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
- PUT Request
var superagent = require('superagent');
superagent
.put('https://postman-echo.com/put')
.set({
'Content-Type': 'text/plain'
})
.send("Etiam mi lacus, cursus vitae felis et, blandit pellentesque neque. Vestibulum eget nisi a tortor commodo dignissim.\nQuisque ipsum ligula, faucibus a felis a, commodo elementum nisl. Mauris vulputate sapien et tincidunt viverra. Donec vitae velit nec metus.")
.end(function (error, response) {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
- PATCH Request
var superagent = require('superagent');
superagent
.patch('https://postman-echo.com/patch')
.set({
'Content-Type': 'text/plain'
})
.send("Curabitur auctor, elit nec pulvinar porttitor, ex augue condimentum enim, eget suscipit urna felis quis neque.\nSuspendisse sit amet luctus massa, nec venenatis mi. Suspendisse tincidunt massa at nibh efficitur fringilla. Nam quis congue mi. Etiam volutpat.")
.end(function (error, response) {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
- DELETE Request
var superagent = require('superagent');
superagent
.delete('https://postman-echo.com/delete')
.set({
'Content-Type': 'text/plain'
})
.end(function (error, response) {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
- POST raw Request (ES6)
const superagent = require('superagent');
superagent
.post('https://postman-echo.com/post')
.set({
'Content-Type': 'text/plain'
})
.send("Duis posuere augue vel cursus pharetra. In luctus a ex nec pretium. Praesent neque quam, tincidunt nec leo eget, rutrum vehicula magna.\nMaecenas consequat elementum elit, id semper sem tristique et. Integer pulvinar enim quis consectetur interdum volutpat. !@#$%^&*()_+-=,.<>/?")
.end((error, response) => {
if (error) throw new Error(error);
console.log(JSON.stringify(response.body));
});
Any updates? @shreys7
@shreys7 Can you give me a heads up on this? Maybe some feedback
Thanks, been a long time.
Good work @ajwad-shaikh 👏
@shreys7 Thanks for #246 The build is now passing CI Tests :)
Hey @shreys7,
Still awaiting your review on this 😄
Thanks!