-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to configure basic auth and request headers
- Loading branch information
Fabian Schneider
committed
Oct 6, 2017
1 parent
f1e51b0
commit e780126
Showing
6 changed files
with
208 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const swaggerCombine = require('../src'); | ||
|
||
const config = (module.exports = { | ||
swagger: '2.0', | ||
info: { | ||
title: 'Swagger Combine Authentication Example', | ||
version: { | ||
$ref: './package.json#/version', | ||
}, | ||
}, | ||
apis: [ | ||
{ | ||
url: 'http://petstore.swagger.io/v2/swagger.json', | ||
resolve: { | ||
http: { | ||
auth: { | ||
username: 'admin', | ||
password: 'secret12345' | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
url: 'https://api.apis.guru/v2/specs/medium.com/1.0.0/swagger.yaml', | ||
resolve: { | ||
http: { | ||
headers: { | ||
authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6ImFkbWluIiwiYWRtaW4iOnRydWV9.44lJS0jlltzcglq7vgjXMXYRTecBxseN3Dec_LO_osI' | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
url: 'https://api.apis.guru/v2/specs/deutschebahn.com/betriebsstellen/v1/swagger.json', | ||
resolve: { | ||
http: { | ||
headers: { | ||
authorization: 'Basic YWRtaW46c2VjcmV0MTIz' | ||
} | ||
} | ||
} | ||
}, | ||
] | ||
}); | ||
|
||
if (!module.parent) { | ||
swaggerCombine(config).then(res => console.log(JSON.stringify(res, false, 2))).catch(err => console.error(err)); | ||
|
||
} |
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