Problem/Motivation

Drupal\migrate_plus\Plugin\migrate_plus\data_fetcher\Http::getResponse now requires returning a ResponseInterface.
This makes sense given that ::getResponseContent will call ->getBody() on the return from getResponse.

Solution

  • ::getResponse calls the apitools client, either with changed methods or with a simple method.
  • The apitools client methods need to be able to return array-like values as they are not intended to be methods specific to a migration http data fetcher.
  • The return from an apitools client can now use an IterableResponse class.
  • This will allow other implementations to iterate over the data results directly, while also allowing getResponse to return a ResponseInterface
  • The getResponseContent will need to bypass use of getBody() and get the array that was embedded in IterableResponse.
  • It will then need to re-encode this array to match the expectations of the data parser in the migration.

Comments

asherry created an issue. See original summary.

  • asherry committed f9ab0960 on 2.0.x
    Issue #3407114: Http data issues and changes
    
asherry’s picture

update: getData should return the iterable data $iterableData. This is just in case any controllers want to manipulate the data, they will be able to do an offsetSet, but they can't (nor shouldn't really) edit the original response data itself. That should be renamed to a specific getResponseData.

  • asherry committed c1c3bd9d on 2.0.x
    Issue #3407114: Fixes getData function to return iterable data that can...
asherry’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

asherry’s picture