Skip to content

Content-Length invalid for unicode text #332

Description

@to-miz

When generating a http request string, the content-length seems to be calculated using the number of codepoints instead of bytes.
This was generated using insomnia, which uses httpsnippet:

POST /api/v1/test HTTP/1.1
Content-Type: text/plain
User-Agent: insomnia/2023.5.8
Host: localhost:5003
Content-Length: 3

äöü

This is what insomnia actually sends when executing the request (visualized using nc -l localhost 5003)

$ nc -l localhost 5003
POST /api/v1/test HTTP/1.1
Host: localhost:5003
Content-Type: text/plain
User-Agent: insomnia/2023.5.8
Accept: */*
Content-Length: 6

äöü

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions