Skip to content

POST Multipart-Encoding does not work if the Content-Type header has been previously defined in the session #6992

@stephane-klein

Description

@stephane-klein

Hi,

I just wasted two hours because it seems that the POST Multiple Multipart-Encoded Files function does not work if a Content-Type has been previously defined at the session level.

Example:


...

session.headers.update({“Content-Type”: “application/json”})

...

response = session.post(
    “http://localhost:3000/api/v1/pipelines/upload”,
    files={
        “file”: (“hello_world3.py”, f, “text/x-python”)
    },
    data={
        “urlIdx”: “2”
    }
)

Two suggestions:

  • a. Either modify the implementation of POST Multiple Multipart-Encoded Files to overwrite the content of the Content-Type header even if it has been defined at the session level
  • b. Or issue a warning message to inform the developer of their possible error

What do you think?

Best regards,
Stéphane

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions