Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
RESTTestBase::httpRequest()
should work with HEAD
requests so that one don't need to override it just to test custom REST services.
Comment | File | Size | Author |
---|---|---|---|
#10 | interdiff.txt | 913 bytes | Wim Leers |
#10 | 2274153-resttestbase-head-request-10.patch | 1.12 KB | Wim Leers |
#3 | 2274153-resttestbase-head-request-2.patch | 1.22 KB | dixon_ |
#1 | 2274153-resttestbase-head-request-1.patch | 1.17 KB | dixon_ |
resttestbase-undefined-var-0.patch | 639 bytes | dixon_ | |
Comments
Comment #1
dixon_Turns out there are more things missing to make
HEAD
requests work withRESTTestBase::httpRequest()
.Updated issue summary and attaching new patch.
Comment #3
dixon_Rerolled the patch and added the possibility of passing in query parameters (the same way as when using
RESTTestBase::httpRequest()
withGET
requests).Comment #4
dixon_3: 2274153-resttestbase-head-request-2.patch queued for re-testing.
Comment #6
dixon_3: 2274153-resttestbase-head-request-2.patch queued for re-testing.
Comment #7
dawehnerAre there usecases for that in core, like when testing the entity services?
Comment #8
jhedstromThere is a tiny bit of reference to HEAD requests in
RequestBase
andCSRFAccessCheck
, and without this patch, that code is presumably untestable?Comment #9
klausihm, we are not doing that for GET requests, putting the $body on the URL as query parameters. So this should have at least a comment?
And this does not apply anymore.
Comment #10
Wim Leers#8: those references are no longer there.
Comment #11
Wim LeersComment #12
dawehnerSeams reasonable. On the longrun it would be nice to just use guzzle here. I think this would be simply more readable.
Comment #13
Wim LeersAbsolutely. Issue for that already exists: #1841474: Convert REST tests to Guzzle (would also help with core moving from WTB to BTB).
Comment #15
dawehner.
Comment #19
alexpottCommitted 13b4525 and pushed to 8.0.x, 8.1.x, 8.2.x (as this is a test-only change). Thanks!