Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62f2272

Browse files
committed
Fix license on npm package. Fix bug in response headers.
1 parent 42c07b8 commit 62f2272

File tree

10 files changed

+28
-4
lines changed

10 files changed

+28
-4
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<VersionPrefix>2.1.0</VersionPrefix>
4+
<VersionPrefix>2.1.1</VersionPrefix>
55
<LangVersion>latest</LangVersion>
66
<Nullable>enable</Nullable>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

VersionHistory.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Version History
22

3+
### 2.1.1
4+
5+
* Fix bug with response headers.
6+
* Fix license on npm package.
7+
38
### 2.1.0
49

510
* Update `Facility.Definition`. (Supports shorthand for required attribute, e.g. `string!`.)

example/ExampleApi.fsd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ service ExampleApi
7575
[http(from: header)]
7676
eTag: string;
7777

78+
[http(from: header, name: "Cache-Control")]
79+
cacheControl: string;
80+
7881
[http(from: body, code: 304)]
7982
notModified: boolean;
8083
}

example/js/exampleApi.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ class ExampleApiHttpClient {
119119
if (headerValue != null) {
120120
value.eTag = headerValue;
121121
}
122+
headerValue = result.response.headers.get('Cache-Control');
123+
if (headerValue != null) {
124+
value.cacheControl = headerValue;
125+
}
122126
return { value: value };
123127
});
124128
}

example/js/exampleApiServer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ export function createApp(service) {
122122
if (result.value.eTag != null) {
123123
res.setHeader('eTag', result.value.eTag);
124124
}
125+
if (result.value.cacheControl != null) {
126+
res.setHeader('Cache-Control', result.value.cacheControl);
127+
}
125128
if (result.value.widget) {
126129
res.status(200).send(result.value.widget);
127130
return;

example/ts/src/exampleApi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ class ExampleApiHttpClient implements IExampleApi {
122122
if (headerValue != null) {
123123
value.eTag = headerValue;
124124
}
125+
headerValue = result.response.headers.get('Cache-Control');
126+
if (headerValue != null) {
127+
value.cacheControl = headerValue;
128+
}
125129
return { value: value };
126130
});
127131
}

example/ts/src/exampleApiServer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ export function createApp(service: IExampleApi): express.Application {
124124
if (result.value.eTag != null) {
125125
res.setHeader('eTag', result.value.eTag);
126126
}
127+
if (result.value.cacheControl != null) {
128+
res.setHeader('Cache-Control', result.value.cacheControl);
129+
}
127130
if (result.value.widget) {
128131
res.status(200).send(result.value.widget);
129132
return;

example/ts/src/exampleApiTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export interface IGetWidgetResponse {
113113

114114
eTag?: string;
115115

116+
cacheControl?: string;
117+
116118
notModified?: boolean;
117119
}
118120

src/Facility.CodeGen.JavaScript/JavaScriptGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public override CodeGenOutput GenerateOutput(ServiceInfo service)
297297
{
298298
code.WriteLine($"headerValue = result.response.headers.get('{httpHeaderField.Name}');");
299299
using (code.Block("if (headerValue != null) {", "}"))
300-
code.WriteLine($"value.{httpHeaderField.Name} = headerValue;");
300+
code.WriteLine($"value.{httpHeaderField.ServiceField.Name} = headerValue;");
301301
}
302302
}
303303

ts/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "facility-core",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Common code for the Facility API Framework.",
55
"scripts": {
66
"build": "tsc && tslint --exclude **/*.d.ts src/*.ts",
@@ -11,7 +11,7 @@
1111
"url": "https://github.com/FacilityApi/FacilityJavaScript.git"
1212
},
1313
"author": "Ed Ball",
14-
"license": "UNLICENSED",
14+
"license": "MIT",
1515
"files": [
1616
"src"
1717
],

0 commit comments

Comments
 (0)