@vtecx/vtecxnext 2.2.10 → 2.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vtecxnext.d.ts +1 -1
- package/dist/vtecxnext.js +5 -5
- package/package.json +1 -1
package/dist/vtecxnext.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export declare class VtecxNext {
|
|
|
81
81
|
null2blank: (val: string | undefined | null) => string;
|
|
82
82
|
/**
|
|
83
83
|
* X-Requested-With header check.
|
|
84
|
-
* If not specified, set status
|
|
84
|
+
* If not specified, set status 401 to the response.
|
|
85
85
|
* @return Response if no X-Requested-With header is specified
|
|
86
86
|
*/
|
|
87
87
|
checkXRequestedWith: () => Response | undefined;
|
package/dist/vtecxnext.js
CHANGED
|
@@ -143,7 +143,7 @@ class VtecxNext {
|
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
145
|
* X-Requested-With header check.
|
|
146
|
-
* If not specified, set status
|
|
146
|
+
* If not specified, set status 401 to the response.
|
|
147
147
|
* @return Response if no X-Requested-With header is specified
|
|
148
148
|
*/
|
|
149
149
|
checkXRequestedWith = () => {
|
|
@@ -155,9 +155,9 @@ class VtecxNext {
|
|
|
155
155
|
this.req.headers.forEach((value, key, parent) => {
|
|
156
156
|
//console.log(`[vtecxnext checkXRequestedWith] key=${key} value=${value}`)
|
|
157
157
|
if (!hasX) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const keyLower = key.toLocaleLowerCase();
|
|
159
|
+
if ((keyLower.startsWith('x-') && !keyLower.startsWith('x-forwarded')) ||
|
|
160
|
+
keyLower === 'authorization') {
|
|
161
161
|
//console.log(`[vtecxnext checkXRequestedWith] key=${key} value=${value}`)
|
|
162
162
|
hasX = true;
|
|
163
163
|
}
|
|
@@ -166,7 +166,7 @@ class VtecxNext {
|
|
|
166
166
|
//console.log(`[vtecxnext checkXRequestedWith] end.`)
|
|
167
167
|
if (!hasX) {
|
|
168
168
|
return new Response('', {
|
|
169
|
-
status:
|
|
169
|
+
status: 401
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
};
|