-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
(function (Prism) { | ||
Prism.languages.http = { | ||
'request-line': { | ||
pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S*\sHTTP\/[0-9.]+/m, | ||
pattern: /^(?:GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|PRI|SEARCH)\s(?:https?:\/\/|\/)\S*\sHTTP\/[0-9.]+/m, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
RunDevelopment
Member
|
||
inside: { | ||
// HTTP Verb | ||
'property': /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/, | ||
// Path or query argument | ||
'attr-name': /:\w+/ | ||
// HTTP Method | ||
'method': { | ||
pattern: /^[A-Z]+\b/, | ||
alias: 'property' | ||
}, | ||
// Request Target e.g. http://example.com, /path/to/file | ||
'request-target': { | ||
pattern: /^(\s)(?:https?:\/\/|\/)\S*(?=\s)/, | ||
lookbehind: true, | ||
alias: 'url' | ||
}, | ||
// HTTP Version | ||
'http-version': { | ||
pattern: /^(\s)HTTP\/[0-9.]+/, | ||
lookbehind: true, | ||
alias: 'property' | ||
}, | ||
} | ||
}, | ||
'response-status': { | ||
pattern: /^HTTP\/1.[01] \d.*/m, | ||
pattern: /^HTTP\/[0-9.]+ \d+ .+/m, | ||
inside: { | ||
// Status, e.g. 200 OK | ||
'property': { | ||
pattern: /(^HTTP\/1.[01] )\d.*/i, | ||
lookbehind: true | ||
// HTTP Version | ||
'http-version': { | ||
pattern: /^HTTP\/[0-9.]+/, | ||
alias: 'property' | ||
}, | ||
// Status Code | ||
'status-code': { | ||
pattern: /^(\s)\d+(?=\s)/, | ||
lookbehind: true, | ||
alias: 'number' | ||
}, | ||
// Reason Phrase | ||
'reason-phrase': { | ||
pattern: /^(\s).+/, | ||
lookbehind: true, | ||
alias: 'string' | ||
} | ||
} | ||
}, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
I'm not sure this is the place to ask this, but I want to know your opinion.
We are working on SIP, which has message syntax very similar to HTTP (see example message here).
For supporting it with PrismJS we could either add a new "language" for it, or make "http" also support it.
My question is: do you think this is important to really specify all the HTTP methods here or can we change it to something like
[A-Z]+
(and also change the http-version to be[A-Z]+\/[0-9.]
)?What do you say?