The problem is that the snippet has so little context that it can't be true that you're interested in feedback on any/all aspects of the code; the snippet is basically a one-liner.
I would downvote (didn't), because I personally don't like that kind of A vs B questions with so little context there's not really anything else to say other than:
- hmm yeah yours looks good because XYZ
- hmm yeah the bottom snippet is better because XYZ
- hmm how about
this little one-liner snippet instead, see how XYZ makes it better
Which in my own personal opinion isn't quite in the "spirit" of what this site is about.
See How to get the best value out of Code Review for a comprehensive description of what's objectively better suited for this site.
That said, you have this:
throw new Error('OhGodWhy')
In real production code? Really? I don't blame the close-voters for deeming it "hypothetical" - the post raises most of the typical flags for that close reason, regardless of my own personal preference against A vs B questions.
Your post says:
We need to check if a given variable is either "get" or "post". If it's neither then I should throw an error.
But we don't know why you need to do that - might be you deem it "irrelevant", but if we could see at least the whole function, or at least a bigger part of the bigger picture, then reviewers could possibly suggest ways to restructure things and perhaps completely avoid throwing that error - I don't know, but that's what reviewers like to do: look at how you're solving a problem, improve your implementation, and point out things that are wrong with the current one.
IMO the "relevant note" at the bottom of the post likely makes reviewers raise an eyebrow and spawns more questions than answers: if that code handles HTTP-GET and HTTP-POST, then what do CRUD operations UPDATE and DELETE have to do with it? What's that variable doing? What's its scope? Who's using it? Why?
If you don't want reviewers to question all the things and raise every flag they can, then you're not looking for a code review - you have a specific programming question (likely opinion-based), but you're not asking for a peer review.
And that's why I'm not going to single-handedly reopen your question: I agree with its closure.