mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Small tweaks and support importers 0.4
This commit is contained in:
parent
d6e5f2f873
commit
d620e73ef8
@ -124,8 +124,8 @@ export const contentTypesMap = {
|
||||
[CONTENT_TYPE_XML]: 'XML',
|
||||
// [CONTENT_TYPE_FORM_DATA]: 'Form Data',
|
||||
[CONTENT_TYPE_FORM_URLENCODED]: 'Form Url Encoded',
|
||||
[CONTENT_TYPE_TEXT]: 'Plain Text',
|
||||
[CONTENT_TYPE_FILE]: 'File Upload',
|
||||
[CONTENT_TYPE_TEXT]: 'Plain Text',
|
||||
[CONTENT_TYPE_RAW]: 'Raw Body',
|
||||
};
|
||||
|
||||
|
@ -4,6 +4,8 @@ import * as models from '../models';
|
||||
import {getAppVersion} from './constants';
|
||||
import * as misc from './misc';
|
||||
|
||||
const EXPORT_FORMAT = 3;
|
||||
|
||||
const EXPORT_TYPE_REQUEST = 'request';
|
||||
const EXPORT_TYPE_REQUEST_GROUP = 'request_group';
|
||||
const EXPORT_TYPE_WORKSPACE = 'workspace';
|
||||
@ -90,7 +92,7 @@ export async function importRaw (workspace, rawContent, generateNewIds = false)
|
||||
export async function exportJSON (parentDoc = null) {
|
||||
const data = {
|
||||
_type: 'export',
|
||||
__export_format: 2,
|
||||
__export_format: EXPORT_FORMAT,
|
||||
__export_date: new Date(),
|
||||
__export_source: `insomnia.desktop.app:v${getAppVersion()}`,
|
||||
resources: {}
|
||||
@ -115,11 +117,12 @@ export async function exportJSON (parentDoc = null) {
|
||||
d._type = EXPORT_TYPE_REQUEST;
|
||||
}
|
||||
|
||||
// Delete the type property because we add our own (_type)
|
||||
// Delete the things we don't want to export
|
||||
delete d.type;
|
||||
delete d._schema;
|
||||
|
||||
return d;
|
||||
});
|
||||
|
||||
return JSON.stringify(data, null, 2);
|
||||
return JSON.stringify(data, null, '\t');
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"hkdf": "0.0.2",
|
||||
"httpsnippet": "git@github.com:getinsomnia/httpsnippet.git#a3a2c0a0167fa844bf92df52a1442fa1d68a9053",
|
||||
"insomnia-importers": "^0.3.1",
|
||||
"insomnia-importers": "^0.4.0",
|
||||
"json-lint": "^0.1.0",
|
||||
"jsonpath-plus": "^0.15.0",
|
||||
"mime-types": "^2.1.12",
|
||||
|
@ -84,6 +84,10 @@ class RequestPane extends Component {
|
||||
)
|
||||
}
|
||||
|
||||
const numParameters = request.parameters.filter(p => !p.disabled).length;
|
||||
const numHeaders = request.headers.filter(h => !h.disabled).length;
|
||||
const hasAuth = !request.authentication.disabled;
|
||||
|
||||
return (
|
||||
<section className="pane request-pane">
|
||||
<header className="pane__header">
|
||||
@ -106,22 +110,17 @@ class RequestPane extends Component {
|
||||
</Tab>
|
||||
<Tab>
|
||||
<button>
|
||||
Auth {request.authentication.username ?
|
||||
<i className="fa fa-lock txt-sm"></i> : ''}
|
||||
Auth {hasAuth ? <i className="fa fa-lock txt-sm"></i> : null}
|
||||
</button>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<button>
|
||||
Query {request.parameters.length ?
|
||||
<span
|
||||
className="txt-sm">({request.parameters.length})</span> : null}
|
||||
Query {numParameters ? <span className="txt-sm">({numParameters})</span> : null}
|
||||
</button>
|
||||
</Tab>
|
||||
<Tab>
|
||||
<button>
|
||||
Headers {request.headers.length ? (
|
||||
<span
|
||||
className="txt-sm">({request.headers.length})</span> ) : null}
|
||||
Headers {numHeaders ? <span className="txt-sm">({numHeaders})</span> : null}
|
||||
</button>
|
||||
</Tab>
|
||||
</TabList>
|
||||
@ -152,7 +151,7 @@ class RequestPane extends Component {
|
||||
<RenderedQueryString
|
||||
request={request}
|
||||
environmentId={environmentId}
|
||||
placeholder="http://myproduct.com?name=Gregory"
|
||||
placeholder="http://awesome-api.com?name=Gregory"
|
||||
/>
|
||||
</code>
|
||||
</div>
|
||||
|
@ -49,9 +49,9 @@ class RequestUrlBar extends Component {
|
||||
{method} <i className="fa fa-caret-down"/>
|
||||
</DropdownButton>
|
||||
{METHODS.map(method => (
|
||||
<DropdownItem key={method} className={`method-${method}`} onClick={e => {
|
||||
<DropdownItem key={method} className={`method-${method}`} onClick={() => {
|
||||
onMethodChange(method);
|
||||
trackEvent('Request', 'Method Change', {method});
|
||||
trackEvent('Request', 'Method Change', method);
|
||||
}}>
|
||||
{method}
|
||||
</DropdownItem>
|
||||
|
@ -40,7 +40,7 @@ class FileInputButton extends Component {
|
||||
addIcon={true}
|
||||
onClick={e => this._handleUnsetFile()}>
|
||||
<i className="fa fa-close"></i>
|
||||
Unset
|
||||
Clear File
|
||||
</DropdownItem>
|
||||
</Dropdown>
|
||||
)
|
||||
|
@ -86,7 +86,7 @@
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"hkdf": "0.0.2",
|
||||
"httpsnippet": "git@github.com:getinsomnia/httpsnippet.git#a3a2c0a0167fa844bf92df52a1442fa1d68a9053",
|
||||
"insomnia-importers": "^0.3.1",
|
||||
"insomnia-importers": "^0.4.0",
|
||||
"json-lint": "^0.1.0",
|
||||
"jsonpath-plus": "^0.15.0",
|
||||
"mime-types": "^2.1.12",
|
||||
|
Loading…
Reference in New Issue
Block a user