NASA-IMPACT / dashboard-api-starter

API for the Earthdata Dashboard
MIT License
1 stars 2 forks source link

If sites are cached, an error is returned #20

Open philvarner opened 3 years ago

philvarner commented 3 years ago

If the sites are cached, the endpoint returns an error.

https://github.com/NASA-IMPACT/dashboard-api-starter/blob/3678af9324e6e1cd15be4fd6183ed4e24fc24b99/dashboard_api/api/api_v1/endpoints/sites.py#L26

    if cache_client:
        sites = cache_client.get_dataset_from_cache(sites_hash)
        if sites:
            response.headers["X-Cache"] = "HIT"

should be:

    if cache_client:
        sites_raw = cache_client.get_dataset_from_cache(sites_hash)
        sites = Sites.parse_raw(sites_raw)
        if sites:
            response.headers["X-Cache"] = "HIT"