Netlify form in development application

How we can test netlify form in a development environnement?

I tried netlify dev but it does not working.

For information, it’s for a react-create-app.

This is my index.html:

    <!-- Netlify Form -->
    <form name="contact" data-netlify="true" netlify-honeypot="bot-field" hidden>
      <p class="hidden">
        <label>Don’t fill this out if you're human: <input name="bot-field" /></label>
      </p>
      <input type="email" name="email"/>
    </form>

and in my app I try to do:

    fetch('/?no-cache=1', {
      method: 'POST',
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
      body: encode({ 'form-name': 'contact', email })
    })

but I have this error:

Request from 127.0.0.1: POST /?no-cache=1
Something went wrong and the function path derived from / (raw form: /) was undefined. Please doublecheck your function naming and toml configuration.
Response with status 500 in 4 ms.
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

Thanks for advance,
Nicolas

Hello @n1c01a5, netlify dev will not allow you to test Netlify form handling. You will need to deploy your form to a test site to test it. That said, feel free to file a feature request here: Issues · netlify/cli · GitHub.