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

Fix accept-language header for /page/related #1229

Merged
merged 6 commits into from
Feb 5, 2020

Conversation

thesocialdev
Copy link
Contributor

@thesocialdev thesocialdev commented Dec 5, 2019

  1. Forward headers to summary endpoint to fetch proper displaytitle for
    language variant
  2. Add test using zh beta
  3. Stop is deleting accept-language header and not forwarding it (language_variants_filter.js#12)

Bug: T231609

@Pchelolo
Copy link
Contributor

Pchelolo commented Dec 5, 2019

One more thing - you probably would want to add accept-language to the related spec.

v1/related.js Outdated Show resolved Hide resolved
d00rman
d00rman previously requested changes Dec 6, 2019
lib/language_variants_filter.js Outdated Show resolved Hide resolved
lib/mwUtil.js Outdated Show resolved Hide resolved
@thesocialdev thesocialdev changed the title WIP: Fix accept-language header for /page/related Fix accept-language header for /page/related Dec 16, 2019
@thesocialdev
Copy link
Contributor Author

thesocialdev commented Dec 16, 2019

I believe tests flaked with 502 HTTP errors. Am I missing something or rechecking CI is needed?

@Pchelolo
Copy link
Contributor

I believe tests flaked with 502 HTTP errors. Am I missing something or rechecking CI is needed?

Restarted a build. Let's seee...

1) Forward headers to summary endpoint to fetch proper displaytitle for
language variant
2) Add test using zh beta
3) TODO: Identify why language_variants_filter.js#12 is deleting
accept-language header and not forwarding it.

Bug: T231609
2) Pass vary and content-language to response
2) Remove unneeded check of shouldConvert
3) Test if accept-language is present in vary header
@thesocialdev
Copy link
Contributor Author

This PR needs another review after rebasing to make sure it complies with recent parsoid cleanup.

@Pchelolo Pchelolo dismissed d00rman’s stale review January 9, 2020 15:54

Not relevan anymore

@thesocialdev
Copy link
Contributor Author

recheck?

lib/mwUtil.js Outdated Show resolved Hide resolved
test/features/related.js Outdated Show resolved Hide resolved
lib/mwUtil.js Outdated Show resolved Hide resolved
lib/mwUtil.js Outdated
if (pRes && pRes.headers && !pRes.headers['content-language']) {
pRes.headers['content-language'] = res.headers && res.headers['content-language'];
mwUtil.addVaryHeader(pRes, 'accept-language');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can return an object [summary, content-language] instead of assigning the header here. I think it would be less magical.

@Pchelolo
Copy link
Contributor

RE-reviewd. LGTM, just some little suggestions.

2) move related tests to language_variants
3) return req instead of undefined
2) Fix some linting issues
3) apply fetchSummary calls to check for summary key when hydrating
responses
4) Deep clone only needed params at language_variant_filter
@mdholloway
Copy link
Contributor

Ping! Is this good to merge?

@Pchelolo Pchelolo merged commit 207d4c1 into wikimedia:master Feb 5, 2020
@mdholloway
Copy link
Contributor

Cool, thanks. Would you mind pinging me next time you deploy restbase so we can test and close out the ticket?

@Pchelolo
Copy link
Contributor

Pchelolo commented Feb 5, 2020

sure

@thesocialdev thesocialdev deleted the fix_related_lang_header branch March 26, 2020 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants