Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Content-Type header to indicate to webhook that we have json for it #5

Closed
wants to merge 1 commit into from
Closed

Add Content-Type header to indicate to webhook that we have json for it #5

wants to merge 1 commit into from

Conversation

robguthrie
Copy link

I'm using Mailin with a Rails 4 application, and I was having trouble because without the Content-Type header being set correctly, rails parses the json as a plain string.

This adds the Content-Type header to the post made to the webhook.

@Flolagale
Copy link
Owner

Hey @robguthrie I've seen your griddler-mailin gem! Cool.
Actually the Content-Type header is correct, it is set to multipart/form-data. What is wrong is that another Content-Type header should be set to application/json for the first part of the payload. This is not yet possible with node-form-data, but an issue is open. Let's see if they want to add this feature, otherwise we'll find a workaround.

For the time being, would it be possible for you to simply parse the string as JSON afterwards? Look like there is a JSON gem for that.

By the way, have you tried receiving an email with an attachment? Any trouble parsing it?

@robguthrie
Copy link
Author

Hi Flolagate,
Sorry for the very slow reply, but I've continued with development and have
just now deployed our reply by email feature.
Thanks for the great software it's been a joy to use!

I've not tried anything with attachments yet.

On Tue, Jul 8, 2014 at 8:32 PM, Flolagale notifications@github.com wrote:

Hey @robguthrie https://github.com/robguthrie I've seen your
griddler-mailin https://rubygems.org/gems/griddler-mailin gem! Cool.
Actually the Content-Type header is correct, it is set to
multipart/form-data. What is wrong is that another Content-Type header
should be set to application/json for the first part of the payload. This
is not yet possible with node-form-data
https://github.com/felixge/node-form-data, but an issue is open
form-data/form-data#74. Let's see if they
want to add this feature, otherwise we'll find a workaround.

For the time being, would it be possible for you to simply parse the
string as JSON afterwards? Look like there is a JSON gem
http://flori.github.io/json/ for that.

By the way, have you tried receiving an email with an attachment? Any
trouble parsing it?


Reply to this email directly or view it on GitHub
#5 (comment).

@robguthrie robguthrie closed this by deleting the head repository Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants