-
Notifications
You must be signed in to change notification settings - Fork 113
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
Attach file, also send body form data #168
Comments
I'm trying to do this as well. I have: return chai.request(server).post('/images')
.attach('image', 'path/to/image.jpg', 'image.jpg')
.type('form')
.send(formDataObject)
.then(res => res.should.have.status(201)) where formDataObject is an object parsed from JSON representing the form keys/values. If I send this request, my validator tells me that an image wasn't uploaded. If I take out the Seems like I can only send one at the expense of the other. |
Possibly related to #97 |
These examples works for me:
|
Sorry, it was just a user error. I had a file filter that i'd forgotten about. Unless others are still facing issues, we can close this. |
@miksansegundo yeess! I'd tried everything.. |
In case anyone else ends up here with my problem: this symptom can also be caused if you try to pass a mongoose _id object as the value to the .field() call. Often that object will be automatically cast to a string, but here it was not. Calling .toString() on the _id object before passing it to .field() got rid of this undefined source.on error. |
Happy that you guys figured this out, closing the issue. |
the same problem for me }); if i send only json without attaching , the body sent to route , otherwise not |
I need to attach a file, and also set a body field. How is this possible? Here's the equivalent RestAssured (Java/Kotlin) test:
The text was updated successfully, but these errors were encountered: