POST request doesn't work with Hardhat task #3941
-
|
I'm using Hardhat on NextJS. My API: My POST request: I send my post request and get this:
I tried a lot of edits, and don't know why I can't run this task. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You are defining a task inside a request handler. That... doesn't make sense? I mean, If what you want is to verify a task programmatically, you have several options, but at least too come to mind:
I can't help you with the details of how to do this, but hopefully that sets you in the right track. |
Beta Was this translation helpful? Give feedback.
You are defining a task inside a request handler. That... doesn't make sense?
I mean,
taskis used inside a Hardhat config to define tasks. Using it in any other context is almost surely a mistake.If what you want is to verify a task programmatically, you have several options, but at least too come to mind:
child_processto runhardhat verifywith the right parameters.hre.runto run the verify task. This is probably a bad idea though, IMO in this context it's more natural to use a Hardhat task as a short-lived action.I can't help you with the details of how to do this, but hopefully that sets you in the right track.