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

Unexpected Content-Disposition in mixed multipart subtype #182

Open
pmstss opened this issue Feb 17, 2023 · 1 comment · May be fixed by #201
Open

Unexpected Content-Disposition in mixed multipart subtype #182

pmstss opened this issue Feb 17, 2023 · 1 comment · May be fixed by #201
Assignees
Labels
Priority: low Type: bug Something isn't working.

Comments

@pmstss
Copy link
Contributor

pmstss commented Feb 17, 2023

Description

multipart/mixed subtype now behaves identically to multipart/form-data

Steps to reproduce

Pass the my-schema.yaml (see below) to the oas2har as follows:

import { oas2har } from '@har-sdk/oas';
import { readFile } from 'fs';
import { promisify } from 'util';
import { load } from 'js-yaml';

const content = await promisify(readFile)(
  './my-schema.yaml',
  'utf8'
);

const result = oas2har(load(content) as OpenAPIV2.Document);
my-schema.yaml
swagger: '2.0'
info:
  title: Mixed multipart data test
  version: 1.0.0
host: brightsec.com
basePath: /v1
schemes:
  - https
consumes:
  - multipart/form-data
produces:
  - application/json
paths:
  /example:
    post:
      consumes:
        - multipart/mixed
      parameters:
        - name: name
          in: formData
          type: string
          required: true
      responses:
        201:
          description: Creation success

Actual result

Multipart entity in HAR entry postData contains Content-Disposition: form-data header:

    "postData": {
      "mimeType": "multipart/mixed; boundary=956888039105887155673143",
      "text": "--956888039105887155673143\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nlorem\r\n--956888039105887155673143--"
    }

Expected result

Seems Content-Disposition should be inline or attachment for mixed subtype:

    "postData": {
      "mimeType": "multipart/mixed; boundary=956888039105887155673143",
      "text": "--956888039105887155673143\r\nContent-Disposition: inline; name=\"name\"\r\n\r\ntest\r\n--956888039105887155673143--"
    }

Additional info

https://www.rfc-editor.org/rfc/rfc2046#section-5.1
https://www.ietf.org/rfc/rfc2183.txt

@pmstss pmstss added the Type: enhancement New feature or request. label Feb 17, 2023
@derevnjuk derevnjuk changed the title Unexpected "Content-Disposition: form-data" in mixed multipart subtype Unexpected Content-Disposition in mixed multipart subtype Feb 17, 2023
@derevnjuk derevnjuk added Type: bug Something isn't working. Priority: low and removed Type: enhancement New feature or request. labels Feb 17, 2023
@derevnjuk
Copy link
Member

@pmstss according to the BNF described at https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1, seems we shouldn't add a Content-Disposition header

@derevnjuk derevnjuk self-assigned this Feb 28, 2023
derevnjuk added a commit that referenced this issue Feb 28, 2023
@derevnjuk derevnjuk linked a pull request Feb 28, 2023 that will close this issue
derevnjuk added a commit that referenced this issue Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: low Type: bug Something isn't working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants