zooniverse / json-api-client

Apache License 2.0
10 stars 5 forks source link

Client requires inconsistent type for include requests #35

Open srallen opened 7 years ago

srallen commented 7 years ago

When making a resource request with the include query param, if the include is only for one resource, apiClient.type('thing').get({linked_id: 'id', include: 'otherThing'}), then the promise doesn't return a resolved value even though the network request is good and returns a 200. It works if you put the included resource into an array: apiClient.type('thing').get({linked_id: 'id', include: ['otherThing']}). If you have multiple comma delimited resources in a string for the include, which is the format the API expects, it works as either as the comma delimited string or as an array.

This might be the relevant code: https://github.com/zooniverse/json-api-client/blob/master/src/resource.coffee#L241-L255