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

Multipart Support #6

Open
jjl opened this issue Oct 3, 2017 · 7 comments
Open

Multipart Support #6

jjl opened this issue Oct 3, 2017 · 7 comments

Comments

@jjl
Copy link
Contributor

jjl commented Oct 3, 2017

Hi. Thanks for writing Ivar, it's helping us manage a smooth migration away from a legacy codebase.

One feature we're missing is multipart body support. It looks like Ivar doesn't have this yet. I'd be willing to contribute it if you don't have plans, but we'd need to discuss a dependency on something else for it.

@swelham
Copy link
Owner

swelham commented Oct 3, 2017

Hi, I'm pleased to hear this lib is helping out 😃

Technically Ivar does multipart already as it supports file uploads and the only adapter currently implemented also supports it. All Ivar does is create a common format that gets passed into the adapter, which then converts it into the format that is required by the underlying lib (HTTPoison for example).

I think what we need here is to extend the put_body functions by adding code that will accept some easy to craft input and then update the adapter code to take this into account.

Could you provide examples of how you would like to see Ivar work with a multipart body? Or if you fancy having a go at implementing it, please feel free to put in a PR and we can discuss it further there.

@jjl
Copy link
Contributor Author

jjl commented Oct 3, 2017

Aha, I only looked at put_body and didn't see it.

Perhaps something like clj-http's multipart option? here (grep for 'multipart')

I'll have a look tomorrow at work about doing it myself.

@swelham
Copy link
Owner

swelham commented Oct 4, 2017

Ok, sounds good.

Feel free to ask any questions or discuss ideas, I'm happy to help.

@jjl
Copy link
Contributor Author

jjl commented Oct 5, 2017

How about I make it so your example works with a :multipart type?

@swelham
Copy link
Owner

swelham commented Oct 5, 2017

Yes I believe that would be a good approach.

One consideration is whether to store the multipart data in a separate list to the files list and let the adapter merge them together, or whether we should merge them together before they reach the adapter.

@jjl
Copy link
Contributor Author

jjl commented Oct 5, 2017

At the moment, I'm going for the principle of smallest change, so i'm trying to avoid changing the format spoken between ivar and the adapter by simply doing what HTTPoison does.

@swelham
Copy link
Owner

swelham commented Oct 5, 2017

Ok sounds good 👍

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

No branches or pull requests

2 participants