Comments (3)
Hi @aivong3, I'll close this issue now, noting that the behaviour is limited to non-RFC3986 compliant paths.
from expressly.
Hi @aivong3,
This looks like a runtime issue, rather than an expressly issue.
Taking the following Compute application, which should return OK (HTTP 200) on any route, and running curl -svo /dev/null "http://127.0.0.1:7676/<"
, produces the same 400 Bad Request
response:
/// <reference types="@fastly/js-compute" />
addEventListener("fetch", (event) => event.respondWith(handleRequest(event)));
async function handleRequest(event) {
console.log(`Request received in Compute: ${event.request.method} ${event.request.url}`)
return new Response("OK", { status: 200 });
}
I am therefore redirecting this issue to the runtime team – CC @JakeChampion
I suspect it's something to do with the <
(non-RFC3986 compliant path) in particular.
Running the following:
curl -svo /dev/null "http://127.0.0.1:7676/not-a-route"
curl -svo /dev/null "https://quickly-sure-caribou.edgecompute.app/not-a-route"
In expressly:
import { Router } from "@fastly/expressly";
const router = new Router();
router.use((req, res) => {
console.log(`Request received: ${req.method} ${req.url}`);
});
router.get("/", async (req, res) => {
return res.send("Hello world!");
});
router.use((err, req, res) => {
console.error(err);
res.withStatus(500).send(`Uh-oh! Something went wrong: ${err.message}`);
});
router.listen();
Results in the expected logs and 500 error.
from expressly.
Hi @doramatadora,
Thanks for taking a look! It would be nice to have the flexibility to handle these bad requests in a custom way like we can for the other errors. Will see if this is possible with the runtime team
from expressly.
Related Issues (8)
- Response.clearCookie returns `Error: TypeError: option expires is invalid`
- feature request: access to waitUntil HOT 3
- feature request: `res.on('finish', callback)` HOT 2
- errors not decorated with status HOT 1
- Cannot extend the `request` object without losing type inference HOT 2
- support explicilty calling the next middleware via `next`
- Expressly request streams always copy the input buffer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expressly.