Skip to content

Commit

Permalink
HTTP: Allow root path in request line (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jxck committed Jan 16, 2021
1 parent 59f725d commit 4e7b2a8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/prism-http.js
@@ -1,7 +1,7 @@
(function (Prism) {
Prism.languages.http = {
'request-line': {
pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S+\sHTTP\/[0-9.]+/m,
pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S*\sHTTP\/[0-9.]+/m,
inside: {
// HTTP Verb
'property': /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-http.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion tests/languages/http/request-line_feature.test
Expand Up @@ -7,6 +7,7 @@ PATCH http://example.com HTTP/1.0
TRACE http://example.com HTTP/1.0
CONNECT http://example.com HTTP/1.0
GET /path/to/foo.html HTTP/1.1
GET / HTTP/1.1

----------------------------------------------------

Expand Down Expand Up @@ -48,9 +49,13 @@ GET /path/to/foo.html HTTP/1.1
["request-line", [
["property", "GET"],
" /path/to/foo.html HTTP/1.1"
]],
["request-line", [
["property", "GET"],
" / HTTP/1.1"
]]
]

----------------------------------------------------

Checks for request lines.
Checks for request lines.

0 comments on commit 4e7b2a8

Please sign in to comment.