Skip to content

Commit 7552a5b

Browse files
committed
Expose response.headers & only serve static files, not directories
1 parent 611b2cd commit 7552a5b

File tree

5 files changed

+1535
-3
lines changed

5 files changed

+1535
-3
lines changed

dist/Response/Response.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/// <reference types="node" />
2+
import { Bag } from '../Bag';
23
import { CookieBag } from '../Cookie/CookieBag';
34
import { ServerResponse } from 'http';
45
export declare class Response {
@@ -14,6 +15,12 @@ export declare class Response {
1415
* @returns {CookieBag}
1516
*/
1617
get cookies(): CookieBag;
18+
/**
19+
* Returns the header bag associated with this response.
20+
*
21+
* @returns {Bag<string>}
22+
*/
23+
get headers(): Bag<string>;
1724
/**
1825
* Sets the HTTP status code of this response.
1926
*

dist/index.js

Lines changed: 1516 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Response/Response.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ export class Response
3535
return this._cookies;
3636
}
3737

38+
/**
39+
* Returns the header bag associated with this response.
40+
*
41+
* @returns {Bag<string>}
42+
*/
43+
public get headers(): Bag<string>
44+
{
45+
return this._headers;
46+
}
47+
3848
/**
3949
* Sets the HTTP status code of this response.
4050
*

src/StaticAssetHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class StaticAssetHandler
156156
continue;
157157
}
158158

159-
if (fs.existsSync(fileName)) {
159+
if (fs.existsSync(fileName) && ! fs.statSync(fileName).isDirectory()) {
160160
return fileName;
161161
}
162162
}

0 commit comments

Comments
 (0)