You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(gatsby-source-wordpress): adjust how endpoint urls are constructed to fix fetching for wordpress.com hosted sites and proxied urls (#10624)
## Description
As reported in #10427 some WordPress.com sites return a `_links.$.self` with a fullpath `https://public-api.wordpress.com/wp/v2/sites/$site/users/me` and others without `https://public-api.wordpress.com/`. This means it is not a reliable way of removing the `baseUrl` from the `fullUrl`.
Instead we pass the route key in as the `fullPath` rather than the `fullUrl`. We then extract the `basePath` from the `baseUrl` before finally removing the `basePath` from the `fullPath`.
We also need to extract the raw entity type from the `fullPath` rather than route.
We also need to build the `fullUrl` from `baseUrl` and `fullPath` so I introduced the `buildFullUrl` function to do just that.
I’ve included tests for both WordPress.com and WordPress.org.
## Related Issues
Fixes#10427.
0 commit comments