Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support for returnMeta query param #335

Merged
merged 3 commits into from
Dec 14, 2021

Conversation

pablopalacios
Copy link
Contributor

returnMeta query param was introduced in order to handle a response format update from the server. There was a time that we would return the data from the resources without making any change. When returnMeta was introduced, we started formatting the response as following:

// successful responses:
{
    data: serviceResponseData,
    meta: serviceResponseMeta,
}

// error responses:
{
    output: serviceErrorOutput,
    meta: serviceResponseMeta,
}

returnMeta was then added to prevent outdated clients to break because of the new format. Years have passed and all browsers should have a fresh copy of fetchr by now. Therefore, we can remove the support for it as requested in the TODO comments (ex.

// TODO: Remove `returnMeta` feature flag after next release
).

One caveat though: when the new format was added, we forgot to update the POST error responses. This PR also addresses this issue.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

responseFormatter(req, res, {
data: data,
meta: meta,
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for cleaning this TODO item up, @pablopalacios !
@redonkulus and I were talking about this recently, about why GET success case wasn't adding the meta data :)

@redonkulus, I checked our internal code using responseFormatter. this changes seems to be ok. You wanna double check?

Copy link
Contributor

@redonkulus redonkulus Dec 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already on v0.7.0 publicly, internally we are on fluxible-plugin-fetch@0.3.x which uses fetchr@0.5.x so this change will not affect us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lingyan oh, but from what I see in the code, only the POST failed responses were not including the meta data. Unless you use a very old fetchr version, I think you should already have meta available. Could it be that the query parser or any other middleware is modifying the query object?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in fact on an old version of fetchr, we have not upgraded to the latest (as it requires regression testing across many apps).

@redonkulus redonkulus merged commit f26e7d8 into yahoo:master Dec 14, 2021
@pablopalacios pablopalacios deleted the remove-return-meta branch December 14, 2021 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants