OpenFn / adaptors

The new home for OpenFn adaptors; re-usable connectors for the most common DPGs and DPI building blocks.
GNU General Public License v3.0
4 stars 8 forks source link

common: Fix request params #614

Closed josephjclark closed 3 weeks ago

josephjclark commented 3 weeks ago

In common http, request parameters in the URL were not getting sent on to the server.

I've tested against the http adaptor with this code:

get('/tracker/trackedEntities/qv0j4JBXQX0.json?fields=*', {
  // query: { fields: '*' },
});

fn(state => {
  console.log(state.data);
});

And this credential (public sandbox)

{
  "configuration": {
    "username": "admin",
    "password": "district",
    "baseUrl": "https://play.im.dhis2.org/stable-2-40-3-2/api/40/"
  }
}

This code calls out to dhis2 for a tracked entity and asks for all fields to be returned (via query parameter). When the query does not get sent, dhis only returns part of the entity, not the full thing.

In production, the logged response does not include enrollments or programOwners. Against the built monorepo, it does.

Versions are bumped, tests are added, this is a critical issue ready for release

mtuchi commented 3 weeks ago

I have tested this code with http adaptor

get('/tracker/trackedEntities/qv0j4JBXQX0.json?fields=*', {
  // query: { fields: '*' },
});

fn(state => {
  console.log(state.data);
  return state;
});

Also tested this 👇🏽

get('/tracker/trackedEntities/qv0j4JBXQX0.json', {
  query: { fields: '*' },
});

fn(state => {
  console.log(state.data);
  return state;
});

Both works fine