【问题标题】:symfony 5 mercure bundle HTTP/1.1 400 Bad Request returnedsymfony 5 mercure bundle HTTP/1.1 400 Bad Request 返回
【发布时间】:2020-05-29 14:13:46
【问题描述】:

我正在尝试使用 symfony mercure 捆绑包,但即使使用文档中给出的示例,它似乎也不起作用。 这是我的控制器中的代码

/**
 * @Route("/test", name="test")
 */
class TestController extends AbstractController
{

    public function __invoke(PublisherInterface $publisher): Response
    {
        $update = new Update(
            '/chat',
            json_encode(['status' => 'OutOfStock'])
        );

        // The Publisher service is an invokable object
        $publisher($update);

        return new Response('published!');
    }

}

这是我得到的错误。

为“http://localhost:3000/.well-known/mercure”返回 HTTP/1.1 400 错误请求。

有人知道出了什么问题吗?

错误图片here

这是my project 的 github 链接

【问题讨论】:

    标签: symfony mercure


    【解决方案1】:

    ? 我发现... 我的环境变量有错误

    MERCURE_PUBLISH_URL = http://localhost:3000 / .well-known/mercury

    而不是

    MERCURE_PUBLISH_URL = http://localhost:3000 //。 众所周知/水星,

    一个斜线太多了?。 谢谢大家

    【讨论】:

      猜你喜欢
      • 2014-04-07
      • 1970-01-01
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-29
      • 2017-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多