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

How can I do an overwrite, to specify a file for a binary? #488

Open
wernermorgenstern opened this issue May 26, 2023 · 1 comment
Open

Comments

@wernermorgenstern
Copy link

I am trying to do an search/replace, to specify a filename, so that I can run postman-to-k6.

I tried using the portmanReplacements, but it is not letting me use the double-quote in the searchFor string.
I tried using the overwrites for the overwriteRequestBody, but it seems to only work for JSON, form-data, and Form url encoded values.

How can do an overwrite on a binary or application/octet-stream?

Here is my OpenAPI Spec:

components:
  parameters:
    fid:
      name: fid
      in: path
      description: File ID
      required: true
      schema:
        type: string
        pattern: \w+\.\w+
        minLength: 4
        maxLength: 24

paths:
  /files/{fid}:
    put:
      summary: Upload File
      operationId: uploadFile
      tags:
        - Files
      parameters:
        - $ref: "#/components/parameters/fid"
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
      responses:
        "201":
          $ref: "#/components/responses/UploadFile"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Forbidden"
        "403":
          $ref: "#/components/responses/NotAuthorised"
        "404":
          $ref: "#/components/responses/NotFound"
        "406":
          $ref: "#/components/responses/NotAcceptable"
        "415":
          $ref: "#/components/responses/UnsupportedType"
        "429":
          $ref: "#/components/responses/TooManyRequests"
        default:
          $ref: "#/components/responses/GeneralError"

And here is what I get currently:

            "header": [
              {
                "key": "Content-Type",
                "value": "application/octet-stream"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "method": "PUT",
            "body": {
              "mode": "file"
            }

And I want it to look this way:

                        "header": [
              {
                "key": "Content-Type",
                "value": "application/octet-stream"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "method": "PUT",
            "body": {
              "mode": "file",
              "file": {
              "src": "FILE_LOCATION"
              }
            }
@thim81
Copy link
Collaborator

thim81 commented Sep 7, 2023

hi @wernermorgenstern

A Portman user shared his config on how to upload file, could be useful for you to try out.
#387 (comment)

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

No branches or pull requests

2 participants