Skip to content

Symfony 6.4 WebTestCase emty body #6521

Answered by jamesisaac
D3xime asked this question in Q&A
Discussion options

You must be logged in to vote

Oh I see. Seeing as you're using APIP, it's probably worth extending ApiTestCase rather than WebTestCase? https://github.com/api-platform/core/blob/main/src/Symfony/Bundle/Test/ApiTestCase.php#L37 that would use HttpClientInterface, and have other benefits as described in the APIP docs: https://api-platform.com/docs/core/testing/

I'm not particularly familiar with Symfony's BrowserKit, but if you want to keep using it instead, a couple of things I notice:

  1. It has a jsonRequest method that would simplify things: https://symfony.com/doc/current/components/browser_kit.html#making-requests
  2. Seeing as Content-Type is an http header, looks like you'd need to prefix it with HTTP_: https://github.…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@D3xime
Comment options

@jamesisaac
Comment options

Answer selected by D3xime
@D3xime
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants