Permalink
Browse files

version 0.4.2, fix bug in JSON parsing

  • Loading branch information...
1 parent 7f5d75b commit 97bfbf60acc361d61b13403e928b1f302d587596 @linus committed Feb 7, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 README.md
  2. +1 −1 docs/discogs.html
  3. +1 −1 lib/discogs.js
  4. +1 −1 package.json
  5. +1 −1 src/discogs.coffee
View
@@ -4,7 +4,7 @@ Discogs: A simple JavaScript wrapper for the Discogs API
`discogs` is a simple wrapper for the [Discogs API](http://www.discogs.com/help/api), written in CoffeeScript and usable in e.g. Node.js.
## Version
-0.4.1
+0.4.2
## Requirements
View
@@ -13,7 +13,7 @@
<span class="nx">url</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Make a request</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">discogsRequest = </span><span class="nf">(url, next) -&gt;</span>
<span class="nv">parseResponse = </span><span class="nf">(err, res, body) -&gt;</span>
<span class="k">return</span> <span class="nx">next</span> <span class="nx">err</span> <span class="k">if</span> <span class="nx">err</span>
- <span class="k">if</span> <span class="o">~</span><span class="nx">res</span><span class="p">.</span><span class="nx">headers</span><span class="p">[</span><span class="s1">&#39;content-type&#39;</span><span class="p">]</span><span class="o">?</span><span class="p">.</span><span class="nx">indexOf</span> <span class="s1">&#39;json&#39;</span> <span class="o">or</span> <span class="o">not</span> <span class="nx">format</span>
+ <span class="k">if</span> <span class="o">~</span><span class="nx">res</span><span class="p">.</span><span class="nx">headers</span><span class="p">[</span><span class="s1">&#39;content-type&#39;</span><span class="p">]</span><span class="o">?</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;json&#39;</span><span class="p">)</span> <span class="o">or</span> <span class="o">not</span> <span class="nx">format</span>
<span class="k">try</span>
<span class="nv">body = </span><span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">body</span>
<span class="k">catch</span> <span class="nx">e</span>
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
{
"name": "discogs",
"description": "Simple client for Discogs API",
- "version": "0.4.1",
+ "version": "0.4.2",
"author": "Linus G Thiel <linus@hanssonlarsson.se> (http://hanssonlarsson.se/)",
"contributors": [
{ "name": "Linus G Thiel", "email": "linus@hanssonlarsson.se" },
View
@@ -20,7 +20,7 @@ exports = module.exports = (format) ->
discogsRequest = (url, next) ->
parseResponse = (err, res, body) ->
return next err if err
- if ~res.headers['content-type']?.indexOf 'json' or not format
+ if ~res.headers['content-type']?.indexOf('json') or not format
try
body = JSON.parse body
catch e

0 comments on commit 97bfbf6

Please sign in to comment.