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

Sending File with import < operator fails #13

Closed
zatkhahi opened this issue Nov 23, 2021 · 5 comments
Closed

Sending File with import < operator fails #13

zatkhahi opened this issue Nov 23, 2021 · 5 comments

Comments

@zatkhahi
Copy link

zatkhahi commented Nov 23, 2021

I am using httpyac vscode extension and wrote this .http file:

`
POST {{server}}/api/Formats/ImportFiles
Authorization: Bearer {{token}}
Content-Type: multipart/form-data; boundary=WebKitFormBoundary

--WebKitFormBoundary
Content-Disposition: form-data; name="ProjectId"

81
--WebKitFormBoundary
Content-Disposition: form-data; name="Format"

fgs
--WebKitFormBoundary
Content-Disposition: form-data; name="Files"; filename="pipes.shp"

< ./sample/pipes.shp
--WebKitFormBoundary
Content-Disposition: form-data; name="Files"; filename="pipes.dbf"

< ./sample/pipes.dbf
--WebKitFormBoundary--

`
This http file works when I use "Rest Client" extension but does not work with httpyac extension send.
The problem is binary data importing with < operator is probably changing the data encoding or something else which the server cannot read the shp file.

@AnWeber
Copy link
Contributor

AnWeber commented Nov 23, 2021

Can you give me a more specific hint as to what is going wrong here. I am successfully submitting PDF files using this function. Are both files binary or is one of them also text where the encoding becomes interesting.
Actually the content of the file is passed directly to Got as a buffer and the encoding is not important. Exception is when explicitly reading is desired with (<@, meta data # @injectVariables or setting requestBodyInjectVariablesExtensions).

@zatkhahi
Copy link
Author

I checked that exactly, it just prepend 2 more bytes to the sending file: 13 and 10 (in decimal byte)

@AnWeber
Copy link
Contributor

AnWeber commented Nov 24, 2021

Thanks for finding out. That's a good hint. There is an unnecessary CRLF attached.

@AnWeber
Copy link
Contributor

AnWeber commented Nov 25, 2021

I have found the cause. It is fixed in the next version. Thanks again for the hint with the bytes

@AnWeber
Copy link
Contributor

AnWeber commented Dec 1, 2021

Fix I rolled out yesterday with the new version

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