datopian / frontend-v2

CKAN / Data Portal frontend as microservice in pure Javascript (Node).
http://tech.datopian.com/frontend/
MIT License
38 stars 18 forks source link

[fix][xs] Fix text view case without redirection #178

Closed gavram closed 4 years ago

gavram commented 4 years ago

@anuveyatsu Please can you review this?

This solves https://gitlab.com/datopian/core/support/-/issues/250

There are cases when JSON/XML resources are external - linked ones. In those cases we don't need redirection. Example:

  1. Dataset: https://donnees.montreal.ca/ville-de-montreal/contrats-et-subventions-api
  2. External resource: http://ville.montreal.qc.ca/vuesurlescontrats/api/

With these changes we first check is there a redirection, and if yes we change the resource URL to res.headers.location. If there is not redirection the URL of the resource remains the same.