Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi2postman",
"version": "2.2.6",
"version": "2.2.7",
"description": "openapi2postman",
"bin": {
"o2p": "index.js"
Expand Down
2 changes: 1 addition & 1 deletion src/generator/authorization.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const _ = require('lodash');

module.exports = function() {

return function get(postmanRequest, status){
if (!postmanRequest.aux.authorization){
return postmanRequest;
Expand Down
19 changes: 9 additions & 10 deletions src/parser/openapiAuthorizationDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ const _ = require('lodash');


module.exports = function() {

return function get(oAuthDefinition){
let definition
for (const i in oAuthDefinition) {
definition = oAuthDefinition[i];

}
const data = parseUrl(definition.flows)
const authKey = _.keys(global.definition.security[0])[0]
Expand All @@ -27,20 +26,20 @@ module.exports = function() {
},
item: [
{
name: "Get OAuth2 Token",
name: `Get OAuth2 Token - ${auth}`,
event: [
{
listen: "test",
script: {
id: "7e78bc50-5882-47e1-9920-754befbbbfc5",
exec: [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var json = pm.response.json();",
"",
`pm.environment.set(\"${auth}\", \"Bearer \"+json.data.access_token);`
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var json = pm.response.json();",
"var token = json.access_token || (json.data && json.data.access_token);",
`pm.environment.set("${auth}", "Bearer "+token);`
],
type: "text/javascript"
}
Expand Down
2 changes: 1 addition & 1 deletion test/generator-authorization.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const assert = require('assert');

describe('generator-authorization', () => {

it('good', () => {

let endpoint = require('../seeds/generatorEndpointInitial.json');
Expand Down