Skip to content

[BUG][Powershell] -WithHttpInfo ContentTypes issue #8329

@EngineerCoding

Description

@EngineerCoding

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

The -WithHttpInfo uses the $Response.Headers['Content-Type'] which may not always be set. Therefore this may result in Null which is not accepted by the DeserializeResponse function.

openapi-generator version

v5.0.0

Steps to reproduce
  1. Generate any Powershell client
  2. Run -WithHttpInfo on an endpoint that doesnt set the content type
Suggest a fix

(ApiClient.ps1)
Either let DeserializeResponse accept null values or use the following for the content type:

$contentTypes = $Response.Headers["Content-Type"]
if ($null -eq $contentTypes) {
    $contentTypes = [string[]]@()
}

# Use this in subsequent DeserializeResponse

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions