Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/SwaggerProvider.DesignTime/OperationCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ type OperationCompiler(schema: OpenApiDocument, defCompiler: DefinitionCompiler,

task {
let! response = x
let! content = RuntimeHelpers.readContentAsString response ct
let! content = RuntimeHelpers.readContentAsString response.Content ct
return (%this).Deserialize(content, innerReturnType)
}
Comment thread
sergey-tihon marked this conversation as resolved.
@>
Expand All @@ -444,7 +444,7 @@ type OperationCompiler(schema: OpenApiDocument, defCompiler: DefinitionCompiler,

task {
let! response = x
let! data = RuntimeHelpers.readContentAsStream response ct
let! data = RuntimeHelpers.readContentAsStream response.Content ct
return data
}
@>
Expand All @@ -456,7 +456,7 @@ type OperationCompiler(schema: OpenApiDocument, defCompiler: DefinitionCompiler,

task {
let! response = x
let! data = RuntimeHelpers.readContentAsString response ct
let! data = RuntimeHelpers.readContentAsString response.Content ct
return data
}
@>
Expand Down
4 changes: 2 additions & 2 deletions src/SwaggerProvider.Runtime/ProvidedApiClientBase.fs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ type ProvidedApiClientBase(httpClient: HttpClient, options: JsonSerializerOption

member this.CallAsync
(request: HttpRequestMessage, errorCodes: string[], errorDescriptions: string[], cancellationToken: System.Threading.CancellationToken)
: Task<HttpContent> =
: Task<HttpResponseMessage> =
task {
let! response = this.HttpClient.SendAsync(request, cancellationToken)

if response.IsSuccessStatusCode then
return response.Content
return response
else
Comment on lines 47 to 55
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description/issue resolution relies on exposing response headers (e.g., via a LastResponseHeaders property or similar), but this change only switches CallAsync to return HttpResponseMessage. As-is, generated client methods still deserialize/return only the body and do not surface headers to consumers, and there is no LastResponseHeaders implementation in this type. Please implement the promised header exposure (and populate it inside CallAsync) or adjust the generated API surface to return headers with results so #179 is actually fixed.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update pr title and description based on the diff of applied changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR metadata to match the current diff in 785f4d0: title now reflects the CallAsync return-type refactor, and description now documents only the 3 applied file changes (no LastResponseHeaders feature).

let code = response.StatusCode |> int
let codeStr = code |> string
Expand Down
5 changes: 2 additions & 3 deletions tests/SwaggerProvider.Tests/RuntimeHelpersTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ module OpenApiExceptionTests =
use handler = new StubHttpMessageHandler(HttpStatusCode.OK, "result")
let client = makeClient handler
use request = new HttpRequestMessage(HttpMethod.Get, "http://stub/pets/1")
let! content = client.CallAsync(request, [||], [||], CancellationToken.None)
let! body = content.ReadAsStringAsync()
use! response = client.CallAsync(request, [||], [||], CancellationToken.None)
let! body = response.Content.ReadAsStringAsync()
body |> shouldEqual "result"
}

Expand All @@ -588,7 +588,6 @@ module OpenApiExceptionTests =
()
}


/// Test types for formatObject tests β€” must be plain .NET classes with declared public properties.
type FmtSingle(name: string) =
member _.Name = name
Expand Down
Loading