-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
Description
According to OpenAPI 3.x specification, it's possible to specify custom headers for parts of multipart requests via EncodingObject.headers
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 OpenAPIV3.Document);my-schema.yaml
openapi: 3.0.1
info:
title: Custom headers in multipart form-data
version: 1.0.0
servers:
- url: https://brightsec.com
paths:
/upload:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
image: {}
encoding:
image:
contentType: image/png, image/jpeg
headers:
X-Custom-Header:
schema:
type: string
required: true
responses:
201:
description: Successful upload
content: {}
Actual result
Multipart form data in HAR entry postData doesn't include X-Custom-Header:
"postData": {
"mimeType": "multipart/form-data; boundary=956888039105887155673143",
"text": "--956888039105887155673143\r\nContent-Disposition: form-data; name=\"image\"; filename=\"image\"\r\nContent-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\n\r\niVBORw0KGgo=\r\n--9568880391058
87155673143--"
}
Expected result
X-Custom-Header presents in postData
Reactions are currently unavailable