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

scenario with multipart field #1579

Closed
yunjoopark opened this issue Apr 29, 2021 · 1 comment
Closed

scenario with multipart field #1579

yunjoopark opened this issue Apr 29, 2021 · 1 comment
Labels

Comments

@yunjoopark
Copy link

yunjoopark commented Apr 29, 2021

After upgrading to 1.0.1, I faced this issue.

In the following feature, multipart field is a json .
I passed it converted to a string to build a request successfully in multiPartInternal()

Scenario: karate test
    * url endpoint
    * def abc =
    """
    {
      a: 'b'
      b: {
        c: 'd'
      }
    }
    """

    Given path '/api/path'
    And headers required_headers
    And multipart file mediaFile = { read: 'image.png', filename: 'image.png', contentType: 'image/png'}
    And multipart field abc = JSON.stringfy(abc)
    When method post
    Then status 200
    And match response.status contains 'ok'

The feature failed with the following output.

{"message":"Content type 'text/plain;charset=UTF-8' not supported"}

logs:

content-disposition: form-data; name="abc"; filename=""
content-type: text/plain; charset=UTF-8
content-length: 27
Completed: true
IsInMemory: true
@yunjoopark yunjoopark changed the title scenario with both multipart file and multipart field scenario with multipart field Apr 29, 2021
@ptrthomas
Copy link
Member

try this please:

And multipart file abc = { value: '#(abc)' }

if that doesn't work, I'm sorry we need you to submit a working example: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants