mgeisler / swift-browser

AngularJS interface for OpenStack Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Content-Type header mis-interpreted

mgeisler opened this issue · comments

When viewing the headers for a Gruntfile.js file, it seems that we get too much data back from the HEAD call we do to read headers. The object has a application/json;charset=utf-8 Content-Type, and while we send a HEAD request, we get a response body back. Angular tries to interpret this as JSON and raises an error:

Error: JSON.parse: unexpected character at line 1 column 1 of the JSON data

The error is raised because the file has a /* ... */ comment and thus isn't valid JSON. However, the underlying problem is that

  1. We get a response body from our HEAD request
  2. We interpret the data in the response body though we only care about the HTTP headers when rendering the object detail page.