1. I had a problems with OPTIONS request when using fetch from within react using Chrome.

    This fix is a work of pure genius.

    To install:

    mkdir src/Middleware

    create a new file named src/Middleware/httpOptionsMiddleware.php and put the contents of the above into it

    Open src/Application.php and append the new hook for the middleware

    // Add routing middleware.
    ->add(new RoutingMiddleware($this))

    // add http options
    ->add( new HttpOptionsMiddleware($this))

  2. Oh and I forgot at the top of src/Application.php

    Near the top under the previous use statements you need to add

    use App\Middleware\httpOptionsMiddleware;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.