Skip to content

HTTP Lexer with "application/x-www-form-urlencoded" - POST body data has no highlight #1620

Closed
@coolhaxy

Description

@coolhaxy

Hi,

When using HTTP Lexer with content type "application/x-www-form-urlencoded", the POST body data does not get highlighted. For example, assume this HTTP request.

Test code:

from pygments import highlight
from pygments.formatters import Terminal256Formatter
from pygments.lexers import HttpLexer

code='''
POST /demo/submit/ HTTP/1.1
Host: pygments.org
Connection: keep-alivk
Cache-Control: max-age=0
Origin: http://pygments.org
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2)
    AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://pygments.org/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: windows-949,utf-8;q=0.7,*;q=0.3

name=test&lang=text&code=asdf&user=
'''

print(highlight(code, HttpLexer(), Terminal256Formatter()))

The headers get highlighted, however all the POST body has the same colour.

Any ideas how to get the body highlighted too?

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lexingarea: changes to individual lexersT-bugtype: a bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions