Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit a5b0266

Browse files
authored
Changed amount of options passed to only be CORS settings
Changed amount of options passed to only be CORS settings so that keys are not passed to public API and prevent access to them from it.
1 parent 7f2241e commit a5b0266

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/api/http-api.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ export class HttpApi {
99
* @param {any} io
1010
* @param {any} channel
1111
* @param {any} express
12+
* @param {any} options object apiOriginAllow
1213
*/
1314
constructor(private io, private channel, private express, private options) { }
1415

1516
/**
1617
* Initialize the API.
1718
*/
1819
init(): void {
19-
if(this.options.apiOriginAllow.allowCors){
20+
if(this.options.allowCors){
2021
this.express.use( (req, res, next) => {
21-
res.header('Access-Control-Allow-Origin', this.options.apiOriginAllow.allowOrigin);
22-
res.header('Access-Control-Allow-Methods', this.options.apiOriginAllow.allowMethods);
23-
res.header('Access-Control-Allow-Headers', this.options.apiOriginAllow.allowHeaders);
22+
res.header('Access-Control-Allow-Origin', this.options.allowOrigin);
23+
res.header('Access-Control-Allow-Methods', this.options.allowMethods);
24+
res.header('Access-Control-Allow-Headers', this.options.allowHeaders);
2425
next();
2526
});
2627
}

0 commit comments

Comments
 (0)