shippo-php-client icon indicating copy to clipboard operation
shippo-php-client copied to clipboard

Incorrect API response

Open Nacoma opened this issue 4 years ago • 0 comments

This can be easily replicated in by running the following test and examining the output in the CurlClient:

https://github.com/goshippo/shippo-php-client/blob/e4b577a0f45675db5df54e14877a2a9f463dfcad/test/ParcelTest.php#L48-L52

The expected output format according to the documentation is:

{
  "next": null,
  "previous": null,
  "results": [
    {
      "object_state": ...
    },
  ]
}

When the page size is 1 the json fragment is:

{
  "next": null,
  "previous": null,
  "results": {
    "object_state": ...
  }

This causes the test to fail in PHP7.4 because the resulting object is not Countable.

Nacoma avatar Jan 16 '20 16:01 Nacoma