File tree Expand file tree Collapse file tree 3 files changed +5
-13
lines changed
algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia
algoliasearch-client-php/lib/RetryStrategy Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,8 @@ public RequestBody serialize(Object obj) throws AlgoliaRuntimeException {
244
244
throw new AlgoliaRuntimeException (e );
245
245
}
246
246
} else {
247
- content = null ;
247
+ // An empty body is defaulted to "{}" to match an empty JSON object
248
+ content = "{}" ;
248
249
}
249
250
250
251
return RequestBody .create (content , MediaType .parse (this .contentType ));
@@ -345,14 +346,6 @@ public Request buildRequest(
345
346
RequestBody reqBody ;
346
347
if (!HttpMethod .permitsRequestBody (method )) {
347
348
reqBody = null ;
348
- } else if (body == null ) {
349
- if ("DELETE" .equals (method )) {
350
- // allow calling DELETE without sending a request body
351
- reqBody = null ;
352
- } else {
353
- // use an empty request body (for POST, PUT and PATCH)
354
- reqBody = RequestBody .create ("" , MediaType .parse (this .contentType ));
355
- }
356
349
} else {
357
350
reqBody = serialize (body );
358
351
}
Original file line number Diff line number Diff line change @@ -277,10 +277,9 @@ private function createRequest(
277
277
$ protocolVersion = '1.1 '
278
278
) {
279
279
if (is_array ($ body )) {
280
- // Send an empty body instead of "[]" in case there are
281
- // no content/params to send
280
+ // An empty body is defaulted to "{}" to match an empty JSON object
282
281
if (empty ($ body )) {
283
- $ body = '' ;
282
+ $ body = '{} ' ;
284
283
} else {
285
284
$ body = \json_encode ($ body , $ this ->jsonOptions );
286
285
if (JSON_ERROR_NONE !== json_last_error ()) {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ module.exports = {
27
27
'!clients/algoliasearch-client-javascript/packages/algoliasearch/jest.config.ts' ,
28
28
29
29
// PHP
30
- '!clients/algoliasearch-client-php/*' ,
30
+ '!clients/algoliasearch-client-php/** ' ,
31
31
'clients/algoliasearch-client-php/lib/Api/*' ,
32
32
'clients/algoliasearch-client-php/lib/Model/**' ,
33
33
'clients/algoliasearch-client-php/lib/Configuration/*' ,
You can’t perform that action at this time.
0 commit comments