Skip to content

Unexpected Content-Disposition in mixed multipart subtype #182

Description

@pmstss

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions