Skip to content

Commit 163c000

Browse files
committed
feat: call new endpoint
1 parent 4ec6801 commit 163c000

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

tests/SwaggerProvider.ProviderTests/v3/Swashbuckle.ReturnTextControllers.Tests.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ let ``Return text/plain GET Test``() =
1515
[<Fact>]
1616
let ``Return text/csv GET Test``() =
1717
api.GetApiReturnCsv() |> asyncEqual "Hello,world"
18+
19+
[<Fact>]
20+
let ``Send & return text/plain POST Test``() =
21+
api.GetApiConsumesText("hello") |> asyncEqual "hello"

tests/Swashbuckle.WebApi.Server/Controllers/ConsumesTextController.fs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/Swashbuckle.WebApi.Server/Controllers/ReturnTextControllers.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ type ReturnCsvController() =
1919
member this.Get() =
2020
"Hello,world" |> ActionResult<string>
2121

22+
[<Route("api/[controller]")>]
23+
[<ApiController>]
24+
type ConsumesTextController() =
25+
[<HttpPost; Consumes("text/plain"); Produces("text/plain")>]
26+
member this.Post([<FromBody>] request: string) =
27+
request |> ActionResult<string>
28+
2229
// Simple CSV output formatter
2330
// This formatter assumes the controller returns a string (already CSV-formatted)
2431
type CsvOutputFormatter() as this =

tests/Swashbuckle.WebApi.Server/Swashbuckle.WebApi.Server.fsproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
@@ -16,7 +16,6 @@
1616
<Compile Include="Controllers\FileController.fs" />
1717
<Compile Include="Controllers\NoContentControllers.fs" />
1818
<Compile Include="Controllers\SpecialCasesControllers.fs" />
19-
<Compile Include="Controllers\ConsumesTextController.fs" />
2019
<Compile Include="Startup.fs" />
2120
<Compile Include="Program.fs" />
2221
<None Include="paket.references" />

0 commit comments

Comments
 (0)