1

When i am tring to upload a image using karate framework i am getting exception as

{
    "message":"Required request part 'file' is not present", 
    "code":500,
    "className":"org.springframework.web.multipart.support.MissingServletRequestPartException"
}

Karate code

Scenario: Adding image  
Given path Endpoints.upload_file  
And multipart file myFile = { read: 'karate-logo.jpg', filename: karate-logo.jpg', contentType: 'image/jpg' }  

And multipart field message = 'image test'  
When method post  

API works fine when i try to hit using postman. Just need to send file in body section with form data key as 'file' and value as the image to upload.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
Vimal K
  • 11
  • 1

1 Answers1

1

The "key" here myFile is the name of the uploaded field. Looks like your server is expecting file. Please rename myFile to file and it should work.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248