[go: up one dir, main page]

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

How to upload files #54

Open
honorduan opened this issue May 17, 2019 · 3 comments
Open

How to upload files #54

honorduan opened this issue May 17, 2019 · 3 comments
Assignees

Comments

@honorduan
Copy link
Collaborator

how to send multipart/form-data type by DHaven.Faux

@bloritsch
Copy link
Collaborator

There isn't support for multipart/form-data right now, but you can use use the [Body] tag to stream the binary directly.

See https://github.com/D-Haven/DHaven.Faux/blob/develop/DHaven.Faux.Test/ParameterTypes/IBlobStore.cs for an example. Specifically:

    [HttpPost("/")]
    [return: ResponseHeader("ETag")]
    Task<string> Upload([Body(Format = Format.Raw)] Stream content, [RequestHeader("Content-Type")] string mimeType,
        [RequestHeader("Content-Length")] long length, [RequestHeader("Content-Disposition")] string disposition);

@honorduan
Copy link
Collaborator Author

Ok, got it. Thanks for your support.

@bloritsch
Copy link
Collaborator

This link is for my reference.... when I eventually get multipart:

https://stackoverflow.com/questions/16416601/c-sharp-httpclient-4-5-multipart-form-data-upload

I will likely have to include some type of support for the HttpPost header to mark the method as multipart/form-data encoding. It will have an impact on how I generate the code that prepares the request object.

@bloritsch bloritsch self-assigned this Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants