Merge branch 'develop' of github.com:getinsomnia/insomnia into develop

This commit is contained in:
Gregory Schier committed 2018-11-05 21:31:18 -05:00
commit dcf12d2a4f
41 files changed
+2199 -1127

No files matched your search

+6 -2
View File
@@ -4546,13 +4546,15 @@
"version": "1.0.0",
"resolved": false,
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"resolved": false,
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -4575,7 +4577,8 @@
"version": "0.0.1",
"resolved": false,
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
@@ -4742,6 +4745,7 @@
"resolved": false,
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -27,6 +27,7 @@ type BaseSettings = {
deviceId: string | null,
updateChannel: string,
updateAutomatically: boolean,
disableUpdateNotification: boolean,
environmentHighlightColorStyle: string,
fontMonospace: string | null,
fontInterface: string | null,
@@ -66,6 +67,7 @@ export function init(): BaseSettings {
deviceId: null,
updateChannel: UPDATE_CHANNEL_STABLE,
updateAutomatically: true,
disableUpdateNotification: false,
environmentHighlightColorStyle: 'sidebar-indicator',
fontMonospace: null,
fontInterface: null,
@@ -1,6 +1,5 @@
// @flow
import type { Request } from '../../../../models/request';
import { newBodyRaw } from '../../../../models/request';
import classnames from 'classnames';
import * as React from 'react';
import autobind from 'autobind-decorator';
import { markdownToHTML } from '../../../../common/markdown-to-html';
@@ -21,8 +20,11 @@ import TimeFromNow from '../../time-from-now';
import * as models from '../../../../models/index';
import * as db from '../../../../common/database';
import { showModal } from '../../modals';
import type { Request } from '../../../../models/request';
import { newBodyRaw } from '../../../../models/request';
import ResponseDebugModal from '../../modals/response-debug-modal';
import Tooltip from '../../tooltip';
import { Dropdown, DropdownButton, DropdownDivider, DropdownItem } from '../../base/dropdown';
type GraphQLBody = {
query: string,
@@ -56,7 +58,8 @@ type State = {
schemaIsFetching: boolean,
hideSchemaFetchErrors: boolean,
variablesSyntaxError: string,
forceRefreshKey: number
forceRefreshKey: number,
automaticFetch: boolean
};
@autobind
@@ -74,6 +77,14 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
this._queryEditor = null;
this._isMounted = false;
const body = GraphQLEditor._stringToGraphQL(props.content);
let automaticFetch;
try {
automaticFetch = JSON.parse(window.localStorage.getItem('graphql.automaticFetch'));
} catch (err) {
automaticFetch = true;
}
this.state = {
body,
schema: null,
@@ -82,7 +93,8 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
schemaIsFetching: false,
hideSchemaFetchErrors: false,
variablesSyntaxError: '',
forceRefreshKey: 0
forceRefreshKey: 0,
automaticFetch
};
}
@@ -235,6 +247,7 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
})
);
console.log('FETCH SCHEMA');
responsePatch = await network.send(introspectionRequest._id, environmentId);
const bodyBuffer = models.response.getBodyBuffer(responsePatch);
@@ -306,6 +319,12 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
await this._fetchAndSetSchema(this.props.request);
}
async _handleToggleAutomaticFetching(): Promise<void> {
const automaticFetch = !this.state.automaticFetch;
this.setState({ automaticFetch });
window.localStorage.setItem('graphql.automaticFetch', automaticFetch);
}
_handlePrettify() {
const { body, forceRefreshKey } = this.state;
const { variables, query } = body;
@@ -399,7 +418,7 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
}
componentWillReceiveProps(nextProps: Props) {
if (nextProps.request.modified !== this.props.request.modified) {
if (this.state.automaticFetch && nextProps.request.url !== this.props.request.url) {
clearTimeout(this._schemaFetchTimeout);
this._schemaFetchTimeout = setTimeout(async () => {
await this._fetchAndSetSchema(nextProps.request);
@@ -455,7 +474,8 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
hideSchemaFetchErrors,
variablesSyntaxError,
forceRefreshKey,
schemaIsFetching
schemaIsFetching,
automaticFetch
} = this.state;
const { query, variables: variablesObject } = GraphQLEditor._stringToGraphQL(content);
@@ -466,6 +486,25 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
return (
<div key={forceRefreshKey} className="graphql-editor">
<Dropdown right className="graphql-editor__schema-dropdown margin-bottom-xs">
<DropdownButton className="space-left btn btn--micro btn--outlined">
schema <i className="fa fa-wrench" />
</DropdownButton>
<DropdownDivider>GraphQL Schema</DropdownDivider>
<DropdownItem onClick={this._handleRefreshSchema} stayOpenAfterClick>
<i className={'fa fa-refresh ' + (schemaIsFetching ? 'fa-spin' : '')} /> Refresh Schema
</DropdownItem>
<DropdownItem onClick={this._handleToggleAutomaticFetching} stayOpenAfterClick>
<i
className={classnames('fa', {
'fa-toggle-on': automaticFetch,
'fa-toggle-off': !automaticFetch
})}
/>{' '}
Automatic Fetch
<HelpTooltip>Automatically fetch schema when request URL is modified</HelpTooltip>
</DropdownItem>
</Dropdown>
<div className="graphql-editor__query">
<CodeEditor
dynamicHeight
@@ -522,19 +561,12 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
)}
</div>
<div className="graphql-editor__meta">
<div className="graphql-editor__schema-notice">
{this.renderSchemaFetchMessage()}
{!schemaIsFetching && (
<button className="icon space-left" onClick={this._handleRefreshSchema}>
<i className="fa fa-refresh" />
</button>
)}
</div>
{this.renderSchemaFetchMessage()}
<div className="graphql-editor__operation-name">{this.renderSelectedOperationName()}</div>
</div>
<h2 className="no-margin pad-left-sm pad-top-sm pad-bottom-sm">
Query Variables{' '}
<HelpTooltip>
Query Variables
<HelpTooltip className="space-left">
Variables to use in GraphQL query <br />(JSON format)
</HelpTooltip>
{variablesSyntaxError && (
@@ -458,6 +458,17 @@ class General extends React.PureComponent<Props, State> {
/>
</label>
</div>
<div className="form-control form-control--thin">
<label className="inline-block">
Disable update notification
<input
type="checkbox"
name="disableUpdateNotification"
checked={settings.disableUpdateNotification}
onChange={this._handleUpdateSetting}
/>
</label>
</div>
<div className="form-control form-control--outlined pad-top-sm">
<label>
Update Channel
@@ -86,6 +86,7 @@ class Toast extends React.PureComponent<Props, State> {
workspaces: await db.count(models.workspace.type),
updatesNotSupported: constants.isLinux(),
autoUpdatesDisabled: !settings.updateAutomatically,
disableUpdateNotification: settings.disableUpdateNotification,
updateChannel: !settings.updateChannel
};
@@ -143,7 +143,7 @@
.dropdown__divider__label {
position: relative;
left: calc(@padding-sm / 2);
left: calc(-1 * @padding-sm);
top: -0.7rem;
color: @hl;
padding-right: 1em;
@@ -244,6 +244,14 @@
height: @line-height-xxs;
}
&.btn--micro {
font-size: @font-size-xs;
line-height: @font-size-xs;
padding: @padding-xxs @padding-xs;
height: auto;
border-radius: 3px;
}
&.btn--outlined {
border: 1px solid @hl-lg;
border-radius: @radius-md;
@@ -1,6 +1,7 @@
@import '../constants/dimensions';
.graphql-editor {
position: relative;
display: grid;
height: 100%;
grid-template-columns: minmax(0, 1fr);
@@ -15,6 +16,19 @@
border-top: 1px dashed var(--hl-sm);
}
.graphql-editor__schema-dropdown {
position: absolute;
top: 0;
right: 0;
z-index: 1000;
margin: @padding-xs;
opacity: @opacity-subtle;
&:hover {
opacity: 1;
}
}
.graphql-editor__query,
.graphql-editor__variables {
height: 100%;
@@ -31,7 +45,6 @@
}
.graphql-editor__schema-notice {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@@ -46,7 +59,7 @@
display: flex;
flex-direction: row;
align-items: center;
padding: 0 @padding-sm;
padding: @padding-xxs @padding-sm;
flex-wrap: wrap;
}
@@ -297,6 +297,10 @@ blockquote {
margin: auto;
}
.auto-margin-left {
margin-left: auto;
}
.outlined {
border: 1px solid @hl-md;
}
@@ -482,6 +486,10 @@ i.fa:not(.fa--skinny) {
margin-left: 0.3em;
}
.space-bottom {
margin-bottom: 0.3em;
}
.space-right {
margin-right: 0.3em;
}
@@ -526,6 +534,10 @@ i.fa:not(.fa--skinny) {
margin-bottom: @padding-sm;
}
.margin-bottom-xs {
margin-bottom: @padding-xs;
}
.margin-top-sm {
margin-top: @padding-sm !important;
}
+165 -1099
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-cookies",
"version": "0.0.9",
"version": "0.0.10",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-importers",
"version": "2.0.8",
"version": "2.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -0,0 +1,33 @@
{
"info": {
"_postman_id": "994955c9-397a-494e-820e-294cbd76c318",
"name": "AWS Signature Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "AWS Signature",
"request": {
"auth": {
"type": "awsv4",
"awsv4": {
"sessionToken": "aws-session-token",
"service": "aws-service-name",
"region": "aws-region",
"secretKey": "aws-secret-key",
"accessKey": "aws-access-key"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}
@@ -0,0 +1,37 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "AWS Signature Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "AWS Signature",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"accessKeyId": "aws-access-key",
"disabled": false,
"region": "aws-region",
"secretAccessKey": "aws-secret-key",
"service": "aws-service-name",
"sessionToken": "aws-session-token",
"type": "iam"
}
}
]
}
@@ -0,0 +1,57 @@
{
"info": {
"_postman_id": "994955c9-397a-494e-820e-294cbd76c318",
"name": "AWS Signature Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "AWS Signature",
"request": {
"auth": {
"type": "awsv4",
"awsv4": [
{
"key": "sessionToken",
"value": "aws-session-token",
"type": "string"
},
{
"key": "service",
"value": "aws-service-name",
"type": "string"
},
{
"key": "region",
"value": "aws-region",
"type": "string"
},
{
"key": "secretKey",
"value": "aws-secret-key",
"type": "string"
},
{
"key": "accessKey",
"value": "aws-access-key",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}
@@ -0,0 +1,37 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "AWS Signature Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "AWS Signature",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"accessKeyId": "aws-access-key",
"disabled": false,
"region": "aws-region",
"secretAccessKey": "aws-secret-key",
"service": "aws-service-name",
"sessionToken": "aws-session-token",
"type": "iam"
}
}
]
}
@@ -0,0 +1,30 @@
{
"info": {
"_postman_id": "229681fe-8c82-44c3-a741-b3dc7dfa870f",
"name": "Basic Auth Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Basic Auth",
"request": {
"auth": {
"type": "basic",
"basic": {
"password": "basic-password",
"username": "basic-username"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Basic Auth Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Basic Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "basic-password",
"type": "basic",
"username": "basic-username"
}
}
]
}
@@ -0,0 +1,42 @@
{
"info": {
"_postman_id": "229681fe-8c82-44c3-a741-b3dc7dfa870f",
"name": "Basic Auth Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Basic Auth",
"request": {
"auth": {
"type": "basic",
"basic": [
{
"key": "password",
"value": "basic-password",
"type": "string"
},
{
"key": "username",
"value": "basic-username",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Basic Auth Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Basic Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "basic-password",
"type": "basic",
"username": "basic-username"
}
}
]
}
@@ -0,0 +1,29 @@
{
"info": {
"_postman_id": "77937747-606b-4086-b4e5-7bc776849a13",
"name": "Bearer Token Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Bearer Token",
"request": {
"auth": {
"type": "bearer",
"bearer": {
"token": "bearer-token-value"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Bearer Token Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Bearer Token",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"prefix": "",
"token": "bearer-token-value",
"type": "bearer"
}
}
]
}
@@ -0,0 +1,37 @@
{
"info": {
"_postman_id": "77937747-606b-4086-b4e5-7bc776849a13",
"name": "Bearer Token Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Bearer Token",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "bearer-token-value",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Bearer Token Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Bearer Token",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"prefix": "",
"token": "bearer-token-value",
"type": "bearer"
}
}
]
}
@@ -0,0 +1,35 @@
{
"info": {
"_postman_id": "8bfb46b0-4a02-4941-b46f-bba11fadd681",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Digest Auth",
"request": {
"auth": {
"type": "digest",
"digest": {
"nonceCount": "digest-nonce-count",
"qop": "digest-qop",
"algorithm": "MD5",
"nonce": "digest-nonce",
"realm": "digest-realm",
"password": "guest",
"username": "guest"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://jigsaw.w3.org/HTTP/Digest/"
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://jigsaw.w3.org/HTTP/Digest/",
"name": "Digest Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "guest",
"type": "digest",
"username": "guest"
}
}
]
}
@@ -0,0 +1,68 @@
{
"info": {
"_postman_id": "8bfb46b0-4a02-4941-b46f-bba11fadd681",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Digest Auth",
"request": {
"auth": {
"type": "digest",
"digest": [
{
"key": "nonceCount",
"value": "digest-nonce-count",
"type": "string"
},
{
"key": "qop",
"value": "digest-qop",
"type": "string"
},
{
"key": "algorithm",
"value": "MD5",
"type": "string"
},
{
"key": "nonce",
"value": "digest-nonce",
"type": "string"
},
{
"key": "realm",
"value": "digest-realm",
"type": "string"
},
{
"key": "password",
"value": "guest",
"type": "string"
},
{
"key": "username",
"value": "guest",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://jigsaw.w3.org/HTTP/Digest/",
"protocol": "https",
"host": ["jigsaw", "w3", "org"],
"path": ["HTTP", "Digest", ""]
}
},
"response": []
}
]
}
@@ -0,0 +1,34 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Digest Authentication Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://jigsaw.w3.org/HTTP/Digest/",
"name": "Digest Auth",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": false,
"password": "guest",
"type": "digest",
"username": "guest"
}
}
]
}
@@ -0,0 +1,155 @@
{
"info": {
"_postman_id": "7864cdf9-3256-42ce-9afb-1a75fe6555bc",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Added to Request Body/URL",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": false,
"addEmptyParamsToSign": true,
"realm": "realm-value",
"nonce": "nonce-value",
"timestamp": "timestamp-value",
"tokenSecret": "token-secret-value",
"token": "access-token-value",
"consumerSecret": "consumer-secret-value",
"consumerKey": "consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "realm-value",
"nonce": "nonce-value",
"timestamp": "timestamp-value",
"tokenSecret": "token-secret-value",
"token": "access-token-value",
"consumerSecret": "consumer-secret-value",
"consumerKey": "consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method PLAINTEXT",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "plaintext-realm-value",
"nonce": "plaintext-nonce-value",
"timestamp": "plaintext-timestamp-value",
"tokenSecret": "plaintext-token-secret-value",
"token": "plaintext-access-token-value",
"consumerSecret": "plaintext-consumer-secret-value",
"consumerKey": "plaintext-consumer-key-value",
"signatureMethod": "PLAINTEXT",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method HMAC-SHA256",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "sha256-realm-value",
"nonce": "sha256-nonce-value",
"timestamp": "sha256-timestamp-value",
"tokenSecret": "sha256-token-secret-value",
"token": "sha256-access-token-value",
"consumerSecret": "sha256-consumer-secret-value",
"consumerKey": "sha256-consumer-key-value",
"signatureMethod": "HMAC-SHA256",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Signature Method HMAC-SHA1",
"request": {
"auth": {
"type": "oauth1",
"oauth1": {
"addParamsToHeader": true,
"addEmptyParamsToSign": true,
"realm": "sha1-realm-value",
"nonce": "sha1-nonce-value",
"timestamp": "sha1-timestamp-value",
"tokenSecret": "sha1-token-secret-value",
"token": "sha1-access-token-value",
"consumerSecret": "sha1-consumer-secret-value",
"consumerKey": "sha1-consumer-key-value",
"signatureMethod": "HMAC-SHA1",
"version": "1.0"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}
@@ -0,0 +1,156 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Body/URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_3__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method PLAINTEXT",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "plaintext-consumer-key-value",
"consumerSecret": "plaintext-consumer-secret-value",
"disabled": false,
"nonce": "plaintext-nonce-value",
"privateKey": "",
"realm": "plaintext-realm-value",
"signatureMethod": "PLAINTEXT",
"timestamp": "plaintext-timestamp-value",
"tokenKey": "plaintext-access-token-value",
"tokenSecret": "plaintext-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_4__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA256",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha256-consumer-key-value",
"consumerSecret": "sha256-consumer-secret-value",
"disabled": false,
"nonce": "sha256-nonce-value",
"privateKey": "",
"realm": "sha256-realm-value",
"signatureMethod": "HMAC-SHA256",
"timestamp": "sha256-timestamp-value",
"tokenKey": "sha256-access-token-value",
"tokenSecret": "sha256-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_5__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA1",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha1-consumer-key-value",
"consumerSecret": "sha1-consumer-secret-value",
"disabled": false,
"nonce": "sha1-nonce-value",
"privateKey": "",
"realm": "sha1-realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "sha1-timestamp-value",
"tokenKey": "sha1-access-token-value",
"tokenSecret": "sha1-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
}
]
}
@@ -0,0 +1,395 @@
{
"info": {
"_postman_id": "7864cdf9-3256-42ce-9afb-1a75fe6555bc",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Added to Request Body/URL",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": false,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method PLAINTEXT",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "plaintext-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "plaintext-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "plaintext-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "plaintext-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "plaintext-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "plaintext-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "plaintext-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "PLAINTEXT",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method HMAC-SHA256",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "sha256-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "sha256-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "sha256-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "sha256-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "sha256-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "sha256-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "sha256-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA256",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Signature Method HMAC-SHA1",
"request": {
"auth": {
"type": "oauth1",
"oauth1": [
{
"key": "addParamsToHeader",
"value": true,
"type": "boolean"
},
{
"key": "addEmptyParamsToSign",
"value": true,
"type": "boolean"
},
{
"key": "realm",
"value": "sha1-realm-value",
"type": "string"
},
{
"key": "nonce",
"value": "sha1-nonce-value",
"type": "string"
},
{
"key": "timestamp",
"value": "sha1-timestamp-value",
"type": "string"
},
{
"key": "tokenSecret",
"value": "sha1-token-secret-value",
"type": "string"
},
{
"key": "token",
"value": "sha1-access-token-value",
"type": "string"
},
{
"key": "consumerSecret",
"value": "sha1-consumer-secret-value",
"type": "string"
},
{
"key": "consumerKey",
"value": "sha1-consumer-key-value",
"type": "string"
},
{
"key": "signatureMethod",
"value": "HMAC-SHA1",
"type": "string"
},
{
"key": "version",
"value": "1.0",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}
@@ -0,0 +1,156 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 1.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Body/URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "consumer-key-value",
"consumerSecret": "consumer-secret-value",
"disabled": false,
"nonce": "nonce-value",
"privateKey": "",
"realm": "realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "timestamp-value",
"tokenKey": "access-token-value",
"tokenSecret": "token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_3__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method PLAINTEXT",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "plaintext-consumer-key-value",
"consumerSecret": "plaintext-consumer-secret-value",
"disabled": false,
"nonce": "plaintext-nonce-value",
"privateKey": "",
"realm": "plaintext-realm-value",
"signatureMethod": "PLAINTEXT",
"timestamp": "plaintext-timestamp-value",
"tokenKey": "plaintext-access-token-value",
"tokenSecret": "plaintext-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_4__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA256",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha256-consumer-key-value",
"consumerSecret": "sha256-consumer-secret-value",
"disabled": false,
"nonce": "sha256-nonce-value",
"privateKey": "",
"realm": "sha256-realm-value",
"signatureMethod": "HMAC-SHA256",
"timestamp": "sha256-timestamp-value",
"tokenKey": "sha256-access-token-value",
"tokenSecret": "sha256-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
},
{
"_id": "__REQ_5__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Signature Method HMAC-SHA1",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"callback": "",
"consumerKey": "sha1-consumer-key-value",
"consumerSecret": "sha1-consumer-secret-value",
"disabled": false,
"nonce": "sha1-nonce-value",
"privateKey": "",
"realm": "sha1-realm-value",
"signatureMethod": "HMAC-SHA1",
"timestamp": "sha1-timestamp-value",
"tokenKey": "sha1-access-token-value",
"tokenSecret": "sha1-token-secret-value",
"type": "oauth1",
"verifier": "",
"version": "1.0"
}
}
]
}
@@ -0,0 +1,50 @@
{
"info": {
"_postman_id": "acf8fcf9-f63b-4bf8-93a9-c95cee40bde4",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Added to Request URL",
"request": {
"auth": {
"type": "oauth2",
"oauth2": {
"accessToken": "oauth2.0-access-token-url",
"addTokenTo": "queryParams"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth2",
"oauth2": {
"accessToken": "oauth2.0-adccess-token-headers",
"addTokenTo": "header"
}
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": "https://insomnia.rest"
},
"response": []
}
]
}
@@ -0,0 +1,58 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
}
]
}
@@ -0,0 +1,74 @@
{
"info": {
"_postman_id": "acf8fcf9-f63b-4bf8-93a9-c95cee40bde4",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Added to Request URL",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "accessToken",
"value": "oauth2.0-access-token-url",
"type": "string"
},
{
"key": "addTokenTo",
"value": "queryParams",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
},
{
"name": "Added to Request Headers",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "accessToken",
"value": "oauth2.0-adccess-token-headers",
"type": "string"
},
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "https://insomnia.rest",
"protocol": "https",
"host": ["insomnia", "rest"]
}
},
"response": []
}
]
}
@@ -0,0 +1,58 @@
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-10-27T19:15:26.661Z",
"__export_source": "insomnia.importers:v0.1.0",
"resources": [
{
"_id": "__GRP_1__",
"_type": "request_group",
"parentId": "__WORKSPACE_ID__",
"name": "Oauth 2.0 Test",
"description": "A collection for testing",
"environment": {}
},
{
"_id": "__REQ_1__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request URL",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
},
{
"_id": "__REQ_2__",
"_type": "request",
"parentId": "__GRP_1__",
"url": "https://insomnia.rest",
"name": "Added to Request Headers",
"description": "",
"method": "GET",
"body": {},
"parameters": [],
"headers": [],
"authentication": {
"disabled": true,
"accessTokenUrl": "",
"authorizationUrl": "",
"grantType": "authorization_code",
"password": "",
"type": "oauth2",
"username": ""
}
}
]
}
@@ -75,7 +75,8 @@ function importRequestItem(item, parentId, schema) {
url: importUrl(request.url),
method: request.method || 'GET',
headers: mapImporter(request.header, importHeader),
body: importBody(request.body, schema)
body: importBody(request.body, schema),
authentication: importAuthentication(request.auth, schema)
};
}
@@ -181,3 +182,214 @@ function mapImporter(arr, importFn) {
return arr.map(importFn);
}
}
function importAuthentication(auth, schema) {
if (!auth) {
return {};
}
if (auth.type === 'awsv4') {
return importAwsV4Authentication(auth, schema);
} else if (auth.type === 'basic') {
return importBasicAuthentication(auth, schema);
} else if (auth.type === 'bearer') {
return importBearerTokenAuthentication(auth, schema);
} else if (auth.type === 'digest') {
return importDigestAuthentication(auth, schema);
} else if (auth.type === 'oauth1') {
return importOauth1Authentication(auth, schema);
} else if (auth.type === 'oauth2') {
return importOauth2Authentication(auth, schema);
} else {
return {};
}
}
function importAwsV4Authentication(auth, schema) {
if (!auth.awsv4) {
return {};
}
const item = {
type: 'iam',
disabled: false,
accessKeyId: 'aws-access-key',
region: 'aws-region',
secretAccessKey: 'aws-secret-key',
service: 'aws-service-name',
sessionToken: 'aws-session-token'
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.accessKeyId = auth.awsv4.accessKey;
item.region = auth.awsv4.region;
item.secretAccessKey = auth.awsv4.secretKey;
item.service = auth.awsv4.service;
item.sessionToken = auth.awsv4.sessionToken;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.accessKeyId = findValueByKey(auth.awsv4, 'accessKey');
item.region = findValueByKey(auth.awsv4, 'region');
item.secretAccessKey = findValueByKey(auth.awsv4, 'secretKey');
item.service = findValueByKey(auth.awsv4, 'service');
item.sessionToken = findValueByKey(auth.awsv4, 'sessionToken');
}
return item;
}
function importBasicAuthentication(auth, schema) {
if (!auth.basic) {
return {};
}
const item = {
type: 'basic',
disabled: false,
username: '',
password: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.username = auth.basic.username;
item.password = auth.basic.password;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.username = findValueByKey(auth.basic, 'username');
item.password = findValueByKey(auth.basic, 'password');
}
return item;
}
function importBearerTokenAuthentication(auth, schema) {
if (!auth.bearer) {
return {};
}
const item = {
type: 'bearer',
disabled: false,
token: '',
prefix: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.token = auth.bearer.token;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.token = findValueByKey(auth.bearer, 'token');
}
return item;
}
function importDigestAuthentication(auth, schema) {
if (!auth.digest) {
return {};
}
const item = {
type: 'digest',
disabled: false,
username: '',
password: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.username = auth.digest.username;
item.password = auth.digest.password;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.username = findValueByKey(auth.digest, 'username');
item.password = findValueByKey(auth.digest, 'password');
}
return item;
}
function importOauth1Authentication(auth, schema) {
if (!auth.oauth1) {
return {};
}
const item = {
type: 'oauth1',
disabled: false,
callback: '',
consumerKey: '',
consumerSecret: '',
nonce: '',
privateKey: '',
realm: '',
signatureMethod: '',
timestamp: '',
tokenKey: '',
tokenSecret: '',
verifier: '',
version: ''
};
if (schema === POSTMAN_SCHEMA_V2_0) {
item.consumerKey = auth.oauth1.consumerKey;
item.consumerSecret = auth.oauth1.consumerSecret;
item.nonce = auth.oauth1.nonce;
item.realm = auth.oauth1.realm;
item.signatureMethod = auth.oauth1.signatureMethod;
item.timestamp = auth.oauth1.timestamp;
item.tokenKey = auth.oauth1.token;
item.tokenSecret = auth.oauth1.tokenSecret;
item.version = auth.oauth1.version;
}
if (schema === POSTMAN_SCHEMA_V2_1) {
item.consumerKey = findValueByKey(auth.oauth1, 'consumerKey');
item.consumerSecret = findValueByKey(auth.oauth1, 'consumerSecret');
item.nonce = findValueByKey(auth.oauth1, 'nonce');
item.realm = findValueByKey(auth.oauth1, 'realm');
item.signatureMethod = findValueByKey(auth.oauth1, 'signatureMethod');
item.timestamp = findValueByKey(auth.oauth1, 'timestamp');
item.tokenKey = findValueByKey(auth.oauth1, 'token');
item.tokenSecret = findValueByKey(auth.oauth1, 'tokenSecret');
item.version = findValueByKey(auth.oauth1, 'version');
}
return item;
}
function importOauth2Authentication(auth, schema) {
if (!auth.oauth2) {
return {};
}
// Note: Postman v2.0 and v2.1 don't export any Oauth config. They only export the token
// So just return a disabled and empty Oauth 2 configuration so the user can fill it in later.
const item = {
type: 'oauth2',
disabled: true,
accessTokenUrl: '',
authorizationUrl: '',
grantType: 'authorization_code',
password: '',
username: ''
};
return item;
}
function findValueByKey(array, key) {
if (!array) {
return '';
}
let obj = array.find(o => o.key === key);
if (obj) {
return obj.value || '';
}
return '';
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-xpath",
"version": "1.0.6",
"version": "1.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-now",
"version": "1.0.8",
"version": "1.0.9",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-os",
"version": "1.0.10",
"version": "1.0.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "insomnia-plugin-uuid",
"version": "1.0.7",
"version": "1.0.8",
"lockfileVersion": 1,
"requires": true,
"dependencies": {