Skip to content

Commit

Permalink
Fix authorization header in Postman colleciton (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido authored Aug 12, 2024
1 parent f941ec8 commit 4dbc73f
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions shell/publish-postman-collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@

def patch_collection(postman_collection: dict) -> None:
"""
Fix type of file in upload forms, while waiting for issue resolution:
https://github.com/postmanlabs/openapi-to-postman/issues/795
Patch authorization header to be in the form: Token token={{apiToken}}
"""
for folder in postman_collection['item']:
for endpoint in folder['item']:
if ('body' in endpoint['request'] and
'formdata' in endpoint['request']['body']):
for input_field in endpoint['request']['body']['formdata']:
if (input_field['key'] == 'file' and
input_field['type'] == 'text'):
input_field['type'] = 'file'
del input_field['value']
for api_key in postman_collection['auth']['apikey']:
if api_key['key'] == 'value':
api_key['value'] = 'Token token={{apiToken}}'


def nest_collection(postman_collection: dict) -> None:
Expand Down

0 comments on commit 4dbc73f

Please sign in to comment.