B
B
bro-dev2017-11-22 18:27:32
JavaScript
bro-dev, 2017-11-22 18:27:32

How to get clean request text in node express?

just like that?

spoiler
app.get("*", (req, res) => {
    res.json(req.rawHeaders);
});

there you can get the headers separately, the http version separately, the method separately, but just the entire request as a pure text, how?
purely rawHeaders returns without this GET / HTTP/1.1\r\n, but I just need the entire request in one line.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2017-11-22
@ms-dred

It is not very clear what is needed, but maybe so
res.end(JSON.stringify(req.rawHeaders))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question