Crates.io api endpoint misbehaving?


#1

It seems that crates.io API endpoint (/api/v1/crates/…) returns some html instead of json data. Is it a known issue or I just missed some designed change ?

Here is what I am getting -

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="/" />
<meta name="cargo/config/environment" content="%7B%22modulePrefix%22%3A%22cargo%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22cargo%22%2C%22version%22%3A%220.0.0+%22%7D%2C%22ember-cli-mirage%22%3A%7B%22usingProxy%22%
3Afalse%7D%2C%22exportApplicationGlobal%22%3Afalse%7D" />
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-58390457-3', 'auto');
      ga('send', 'pageview');
    </script>
    <link rel="stylesheet" href="assets/vendor-db1aae18a50d64dc7d57cc30890fa4a9.css" integrity="sha256-BNzAqdX315uGCMZ+Mhy5e9unITZNga7j1LRaNQMd7Vo= sha512-XpGtgO4TAatQ8EeYbfBDas
J+PHHm7NJj0iEsUfbkJ+Sp6AAcM1iSPeYTsF9Zyiidc/h+Oiwl//8lnb3Tl94mzA==" >
    <link rel="stylesheet" href="assets/cargo-70c45bc617f2d8772dbd67879a0d34d1.css" integrity="sha256-fWiStUX+hzGwAz1NmQ4d+nLcKT5pn9BGOO7a0etmBGo= sha512-eVELIFzRKYZ0xn4CTmQSQQm
ceLPIS3G4piyWwGlMAOMdOc7d1HvYhy13wz4OGPUb2VVnVa9mwFrUxiwH8a2daQ==" >
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Cargo">
  </head>
  <body>
    <noscript>
        <div id="main">
            <div class='noscript'>
                This site requires that JavaScript to be enabled.
            </div>
        </div>
    </noscript>
    <script src="assets/vendor-770437b6b2c7a48fd61926b4f8799d57.js" integrity="sha256-74QHf+a4Lt20RbQCoq0gVc59SR31Y35MOGUpwDfvRJU= sha512-BghgyiJClAiFKbNT4JcmnMxg2nIQ+DjJJ5ozaFu
/wXZbkp/aMLF5vbK/fkrvbjQA2Reqndb8Msz/YOE4/uzwww==" ></script>
    <script src="assets/cargo-2df07fc10caea072aafedcdda49467aa.js" integrity="sha256-Afyz1lT7igrXmxCkzQyGqs2iupkpNWN/E4pG1JtcgZE= sha512-N94mmlHPNX3T+3nYA5VOnEfu+W/yKtug+DyUFtfz
z4HngaK+wsDMV1iZWgZfEcEcONvSQJI+DxW+emAIAFaFcw==" ></script>
  </body>
</html>

#2

Check your Accept header, you’re probably requesting text/html.


#3

I’d bet it’s the opposite: no accept header. see


#4

Thanks. I’ll double check Accept header. I pretty much sure I’ve tested with and without Accept header with the same result. I see that the changeset in question was reverted though.