GithubHelp home page GithubHelp logo

Comments (6)

kocsismate avatar kocsismate commented on June 3, 2024

That would be awesome indeed if Harmony could work well with third party middlewares! So thank you really much for the report as the current mechanism wasn't intentional. :)

Could you tell me other details about your setup? Did you use any official Harmony middleware along with the CORS one? If so, I do hope the only problem is that Harmony's middlewares don't return a response (as you said in the title of the issue).

from harmony.

kocsismate avatar kocsismate commented on June 3, 2024

I just pushed the fixes to the master branch! Could you ensure if it works for you?

from harmony.

superbull avatar superbull commented on June 3, 2024

hi @kocsismate , after this modification, everything works. Below is my setup:

$app
    ->addMiddleware('cors', $corsMiddleware)
    ->addMiddleware("fast_route", new FastRouteMiddleware($router))
    ->addMiddleware("dispatcher", new DispatcherMiddleware($container))
    ->addFinalMiddleware("responder", new DiactorosResponderMiddleware(new SapiEmitter()));

Actually I am also working with your yin-middlewares, I think there are also some modifications needed. For example, in JsonApiDispatcherMiddleware.php an ErrorDocument is returned directly from the middleware:

// JsonApiDispatcherMiddleware.php

...
if ($callable === null) {
    return $this->getDispatchErrorDocument($this->getDispatchError())->getResponse($response);
}
...

from harmony.

kocsismate avatar kocsismate commented on June 3, 2024

Good job with the PR, I'll release Harmony 2.3 shortly with this fix! Your comment on Yin-middlewares is also valid, I'll address it soon.

from harmony.

kocsismate avatar kocsismate commented on June 3, 2024

I've done with the release: Harmony will trigger a deprecated notice if a middleware returns with a Response.

from harmony.

superbull avatar superbull commented on June 3, 2024

good news!

from harmony.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.