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

Uploading file with metadata using unirest js api causing trouble when sending data #132

Open
mohan491986 opened this issue Jun 5, 2020 · 0 comments

Comments

@mohan491986
Copy link

I am need to pass file with metadata and I followed the way mentioned in documentation
Client nodejs-
unirest.post(url)
.auth({user:'username', pass:'pwd'})
.header({'Content-Type': 'multipart/form-data'})
.field('objectMetadata', JSON.Stringify(json obj))
.field("file1", fs.createReadStream("setup.docx"))
.then(function (response) {
console.log(response.body)
});
Server - Java based
public Response uploadFileWithMetadata(ObjectMetadata objectMetadata, MultipartBody multipartBody) {}

In the server user says he see objectMetadata object as null and in multipartBody he sees 2 atts - one for file and other for objectmetadata. Same server works for unirest java and I tweaked the metadata part as below

.field("objectMetadata", params, false, "application/json")

Please let me know if I am missing something in the node based svc call

after retries, I need below snippet java equivalent in nodejs

.field(name, value, file, contentType)

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

1 participant