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

MultipartFormData is not present in json export #63

Closed
jcamiel opened this issue Nov 2, 2020 · 5 comments
Closed

MultipartFormData is not present in json export #63

jcamiel opened this issue Nov 2, 2020 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Nov 2, 2020

MultipartFormData is not present in json export.

With this file:

POST http://localhost:8000/multipart-form-data
[MultipartFormData]
key1: value1
upload1: file,hello.txt;
upload2: file,hello.html;
upload3: file,hello.txt; text/html

HTTP/1.0 200

and

hurl --json /tmp/test.json -v integration/tests/multipart_form_data.hurl

The report is :

[
  {
    "filename": "integration/tests/multipart_form_data.hurl",
    "entries": [
      {
        "request": {
          "method": "POST",
          "url": "http://localhost:8000/multipart-form-data",
          "queryString": [],
          "headers": [],
          "cookies": [],
          "body": ""
        },
        "response": {
          "httpVersion": "HTTP/1.0",
          "status": 200,
          "cookies": [],
          "headers": [
            {
              "name": "Content-Type",
              "value": "text/html; charset=utf-8"
            },
            {
              "name": "Content-Length",
              "value": "0"
            },
            {
              "name": "Server",
              "value": "Werkzeug/1.0.1 Python/3.8.5"
            },
            {
              "name": "Date",
              "value": "Mon, 02 Nov 2020 13:00:52 GMT"
            }
          ]
        },
        "captures": [],
        "asserts": [
          {
            "actual": "1.0",
            "expected": "1.0"
          },
          {}
        ],
        "time": 9
      }
    ],
    "success": true,
    "time": 9,
    "cookies": []
  }
]
@jcamiel jcamiel added the bug Something isn't working label Nov 2, 2020
@fabricereix
Copy link
Collaborator

The HAR structure for multipart form data params can be used.
The example above will be expressed by:

"multipart_form_data": [
    {
        "name": "key1",
        "value": "value1"
    },
    {
        "name": "upload1",
        "value": "Hello World!",
        "fileName": "hello.txt",
        "contentType": "text/plain"
    },
    {
        "name": "upload2",
        "value": "Hello <b>World</b>!",
        "fileName": "hello.html",
        "contentType": "text/html"
    },
    {
        "name": "upload3",
        "value": "Hello <b>World</b>!",
        "fileName": "Hello World!",
        "contentType": "text/html"
    }
]

@fabricereix
Copy link
Collaborator

Note that the value is optional (same than HAR)
for example, the data from the file might not be a UTF8 encoded String. In this case, the value field will not be included.

@jcamiel
Copy link
Collaborator Author

jcamiel commented Nov 3, 2020

Looks good! Small point: if possible, we should not mix snake case (multipart_form_data) and camel case (fileName) (unless it's the case in the HAR format)

@fabricereix
Copy link
Collaborator

HAR is definitely camel case, and I tend to prefer snake case for json
but yes we should not mix and stick to camel case

@fabricereix
Copy link
Collaborator

fixed in #67

@lepapareil lepapareil added this to the 0.99 milestone Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants