Skip to content

How can I get separation by QueryString? #1335

Answered by kettanaito
JUDONGHYEOK asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @JUDONGHYEOK. Could you please clarify what do you mean by "separate url by QueryString"?

Ideally, describe what you want to do, what you're doing to achieve that, and what happens in actuality.

The setup above looks correct. One thing, I'd suggest you use return req.passthrough() instead of return ctx.fetch(req) to bypass a request. ctx.fetch() will perform another request, and then return its response as a mocked response. That's not really what you want in your case, as you're not modifying that returned response.

I generally recommend writing handlers per route. That's also the reason why query parameters mustn't include query params in the handler paths.

rest.get('/my/resource', (r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JUDONGHYEOK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1334 on July 16, 2022 11:37.