You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
I think the solution here is to send the attachment as a Nylas file object if it is >3mb. I have the following code that is working for me.
if attachment.blob.byte_size > 3.megabytes
Nylas::FileUtils.attach_file_request_builder(file_path, name)
else
{
content: base64_content,
content_type: attachment.content_type,
filename: name,
}
end
-- UPDATE --
Looking deeper into it, I think you can just use Nylas::FileUtils.attach_file_request_builder for all requests and it should handle them (as of 6.1.1). The one bug here is you lose filename if the attachment is >3MB, but that's probably a separate bug.
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.
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"
The text was updated successfully, but these errors were encountered: