Skip to content

Client never add "config.encoding" inside the Content-Type header #1230

Description

@Killian-fal

Hello,

I am using the client to send a request but I get this error :
xsdata.exceptions.ParserError: not well-formed (invalid token): line 1, column 142

I read this Issue #773 . Then, I looked the code and I found that the config.encoding is only used to encode the body.

So, I made a PR to fix this by adding the self.config.encoding in the content-type header. (After testing, this fix my issue)

Thanks !

My client :

    client = Client(
        config=Config.from_service(
            operation,
            location=service_path,
            encoding="utf-8",
        ),
        parser=XmlParser(config=ParserConfig(fail_on_unknown_properties=False)),
        transport=DefaultTransport(timeout=_TIMEOUT_SECONDS, session=session),
    )

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions