insomnia/app/ui/components/codemirror/modes/curl.js
Gregory Schier 75fbf60274 A bunch more smaller things for v5 (#124)
* Use Curl constants for info

* Extra timeline info and cookie url encoding setting

* Add warning to environment selector

* Title attribute on the autocomplete types

* Added test
2017-03-29 16:09:28 -07:00

23 lines
853 B
JavaScript

import CodeMirror from 'codemirror';
import 'codemirror/addon/mode/simple';
CodeMirror.defineSimpleMode('curl', {
start: [
// Regular key-value header tokens
{regex: /^(> )([\w-]*: )(.*)$/, token: ['curl-prefix curl-out', 'curl-out', 'curl-out curl-value']},
{regex: /^(< )([\w-]*: )(.*)$/, token: ['curl-prefix curl-in', 'curl-in', 'curl-in curl-value']},
// Header fields ("POST /foo/bar HTTP/1.1")
{regex: /^(> )([^:]+ .*)$/, token: ['curl-prefix curl-out curl-header', 'curl-out curl-header']},
{regex: /^(< )([^:]+ .*)$/, token: ['curl-prefix curl-in curl-header', 'curl-in curl-header']},
// Data
{regex: /^(\| )(.*)$/, token: ['curl-prefix curl-data', 'curl-data']},
// Informational text
{regex: /^(\* )(.*)$/, token: ['curl-prefix curl-comment', 'curl-comment']}
],
comment: [],
meta: {}
});