lambder 2.0.7 → 2.0.8
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.
|
@@ -154,10 +154,12 @@ export default class LambderResponseBuilder {
|
|
|
154
154
|
;
|
|
155
155
|
async file(filePath, headers, fallbackFilePath) {
|
|
156
156
|
const doesFileExist = await this.checkPublicFileExist(filePath);
|
|
157
|
-
if (!doesFileExist
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
if (!doesFileExist) {
|
|
158
|
+
if (fallbackFilePath) {
|
|
159
|
+
const doesFallbackExist = await this.checkPublicFileExist(fallbackFilePath);
|
|
160
|
+
if (doesFallbackExist) {
|
|
161
|
+
return await this.file(fallbackFilePath, headers);
|
|
162
|
+
}
|
|
161
163
|
}
|
|
162
164
|
return this.json({ error: "File not found: " + filePath });
|
|
163
165
|
}
|
package/package.json
CHANGED
|
@@ -211,10 +211,12 @@ export default class LambderResponseBuilder<TResponse = any> {
|
|
|
211
211
|
fallbackFilePath?: string,
|
|
212
212
|
):Promise<LambderResolverResponse>{
|
|
213
213
|
const doesFileExist = await this.checkPublicFileExist(filePath);
|
|
214
|
-
if(!doesFileExist
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
if(!doesFileExist){
|
|
215
|
+
if(fallbackFilePath){
|
|
216
|
+
const doesFallbackExist = await this.checkPublicFileExist(fallbackFilePath);
|
|
217
|
+
if(doesFallbackExist){
|
|
218
|
+
return await this.file(fallbackFilePath, headers);
|
|
219
|
+
}
|
|
218
220
|
}
|
|
219
221
|
return this.json({ error: "File not found: " + filePath })
|
|
220
222
|
}
|