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

FIX: Content-Length header was not send in modeled API response #2022

Merged
merged 4 commits into from
Oct 5, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions backend/Origam.Server/CoreHttpTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class CoreHttpTools : IHttpTools
{
disposition = "attachment; " + disposition;
}
response.AppendHeader(
"content-length",
file == null ? "0" : file.Length.ToString());
response.AppendHeader("content-disposition", disposition);
response.OutputStreamWrite(file, 0, file.Length);
}
Expand Down
6 changes: 6 additions & 0 deletions model-tests/ApiCallExamples/publicApiTestExamples.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@port = 44357

// gets a file from the Attachment table by Id
GET https://localhost:{{port}}/api/public/Attachment/E65251F1-FD5B-4307-B0A7-4C9F5594A1AF


Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<x:file
xmlns:x="http://schemas.origam.com/model-persistence/1.0.0"
xmlns:asi="http://schemas.origam.com/Origam.Schema.AbstractSchemaItem/6.0.0"
xmlns:dsfs="http://schemas.origam.com/Origam.Schema.EntityModel.DataStructureFilterSet/6.0.0"
xmlns:dsfsf="http://schemas.origam.com/Origam.Schema.EntityModel.DataStructureFilterSetFilter/6.0.0"
xmlns:dsm="http://schemas.origam.com/Origam.Schema.EntityModel.DataStructureMethod/6.0.0">
<dsfs:DataStructureFilterSet
asi:abstract="false"
dsfs:dynamic="false"
x:id="5e3f2d11-7558-45db-8fbf-aad3064311f0"
asi:name="GetById"
x:parentId="04a07967-4b59-4c14-8320-e6d073f6f77f">
<dsfsf:DataStructureFilterSetFilter
asi:abstract="false"
dsfsf:entity="Root/DataStructure/__system/Attachment.origam#Attachment/Attachment/500d0e9a-25eb-4ed8-aef5-fc220f40b00a"
dsfsf:filter="Root/DataEntity/__Origam General Interfaces/IOrigamEntity.origam#IOrigamEntity/GetId/02c6ef72-70bd-4971-90e9-51e64705eea9"
x:id="4e136bbb-a9f1-4405-b6c5-c6e23b8a46ec"
asi:name="Attachment_GetId"
dsfsf:passWhenParameterMatch="false" />
</dsfs:DataStructureFilterSet>
<dsfsf:DataStructureFilterSetFilter
asi:abstract="false"
dsfsf:entity="Root/DataStructure/__system/Attachment.origam#Attachment/Attachment/500d0e9a-25eb-4ed8-aef5-fc220f40b00a"
dsfsf:filter="Root/DataEntity/__Origam General Interfaces/IOrigamEntity.origam#IOrigamEntity/GetId/02c6ef72-70bd-4971-90e9-51e64705eea9"
x:id="cf97e6cd-2b76-4eae-8286-a34e8ddbb261"
asi:name="Attachment_GetId"
x:parentId="646db93b-f8ed-4095-8c83-de49d75dc130"
dsfsf:passWhenParameterMatch="false" />
</x:file>
28 changes: 28 additions & 0 deletions model-tests/model/Widgets/Page/Attachment.origam
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<x:file
xmlns:x="http://schemas.origam.com/model-persistence/1.0.0"
xmlns:ap="http://schemas.origam.com/Origam.Schema.GuiModel.AbstractPage/6.0.0"
xmlns:asi="http://schemas.origam.com/Origam.Schema.AbstractSchemaItem/6.0.0"
xmlns:fdp="http://schemas.origam.com/Origam.Schema.GuiModel.FileDownloadPage/6.0.0"
xmlns:ppm="http://schemas.origam.com/Origam.Schema.GuiModel.PageParameterMapping/6.0.0">
<fdp:Page
asi:abstract="false"
ap:allowDelete="false"
ap:allowPut="false"
fdp:contentField="Data"
fdp:dataStructure="Root/DataStructure/__system/Attachment.origam#Attachment/04a07967-4b59-4c14-8320-e6d073f6f77f"
fdp:fileNameField="FileName"
x:id="adaf85bc-ea6b-46e7-8504-dcac6d8e7432"
fdp:method="Widgets/DataStructure/__system/Attachment.origam#Attachment/GetById/5e3f2d11-7558-45db-8fbf-aad3064311f0"
ap:mimeType="?"
asi:name="Attachment"
ap:roles="*"
ap:url="api/public/Attachment/{Id}">
<ppm:PageParameterMapping
asi:abstract="false"
x:id="0c18fef3-af11-40e8-94b7-6551dc7e6414"
ppm:isList="false"
ppm:mappedParameter="Id"
asi:name="Attachment_parId" />
</fdp:Page>
</x:file>
20 changes: 20 additions & 0 deletions model-tests/model/Widgets/Page/PrivateLinkReportAPI.origam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<x:file
xmlns:x="http://schemas.origam.com/model-persistence/1.0.0"
xmlns:ap="http://schemas.origam.com/Origam.Schema.GuiModel.AbstractPage/6.0.0"
xmlns:asi="http://schemas.origam.com/Origam.Schema.AbstractSchemaItem/6.0.0"
xmlns:xdp="http://schemas.origam.com/Origam.Schema.GuiModel.XsltDataPage/6.0.0">
<xdp:Page
asi:abstract="false"
ap:allowDelete="false"
ap:allowPut="false"
xdp:disableConstraintForInputValidation="false"
x:id="0092188b-d2be-4a03-bd12-550a6bfe4256"
ap:mimeType="text/html"
asi:name="PrivateLinkReportAPI"
xdp:omitJsonRootElement="false"
xdp:processGetReadRowLevelRules="false"
ap:roles="*"
xdp:transformation="Widgets/Transformation/Widgets/LinkReportHtml.origam#LinkReportHtml/c286449e-09ed-42d1-9a25-45937026bc05"
ap:url="api/private/link-report" />
</x:file>