Skip to content

Set multipart/form-data header while sending attachments > 3mb #486

@byteg

Description

@byteg

Describe the bug
"Content-Type": "multipart/form-data" is not set when I try to send attachments > 3mb.

To Reproduce
Some steps involved to reproduce the bug and any code samples you can share.

request_body = {
  subject: "send large attachments",
  body: "large attachments",
  attachments: [
    {  content: "<large content here>", content_type: "", size: SIZE, filename: "filename"}
  ],
  to: [{email: "some@one.com"}]
}
response, _request_id = nylas.messages.send(identifier:, request_body:)

I get an error:
Nylas::NylasApiError (request must be of content-type multipart/form-data or application/json):
Expected behavior
Large attachments are sent correctly

SDK Version:
nylas (6.1.1)

Additional context
Update: IT DOES NOT HELP
Possible fix:
https://github.com/nylas/nylas-ruby/blob/main/lib/nylas/handler/http_client.rb#L101
Add line:
resulting_headers["Content-type"] = "multipart/form-data"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions