Skip to content

Commit

Permalink
Merge branch 'master' of github.com:medialab/artoo
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Nov 16, 2016
2 parents 6a2a225 + facc765 commit 34aceeb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ Contributions are more than welcome. Feel free to submit any pull request as lon

To install the development environment, clone your fork and use the following commands:

```bash
# Install dependencies
npm install
# Install dependencies
npm install

# Testing
npm test
# Testing
npm test

# Compiling dev & prod bookmarklets
gulp bookmarklets
# Compiling dev & prod bookmarklets
gulp bookmarklets

# Running a test server hosting the concatenated file
npm start
# Running a test server hosting the concatenated file
npm start

# Running a https server hosting the concatenated file
# Note that you'll need some ssl keys (instructions to come...)
npm run https
```
# Running a https server hosting the concatenated file
# Note that you'll need some ssl keys (instructions to come...)
npm run https

## Authors
**artoo.js** is being developed by [Guillaume Plique](https://github.com/Yomguithereal) @ SciencesPo - [médialab](http://www.medialab.sciences-po.fr/fr/).
Expand Down
4 changes: 2 additions & 2 deletions meta.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "artoo.js",
"authors": ["Guillaume Plique"],
"url": "http://tools.medialab.sciences-po.fr/artoo.js/",
"url": "https://medialab.github.io/artoo/",
"source": "https://github.com/medialab/artoo",
"licence": "MIT",
"visual": "http://tools.medialab.sciences-po.fr/artoo.js/res/visual",
"visual": "",
"description": "artoo.js - the client-side scraping companion.",
"doc": ""
}
10 changes: 8 additions & 2 deletions src/methods/artoo.methods.ajaxSniffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,22 @@
var contentType = xhr.getResponseHeader('Content-Type'),
data = xhr.response;

if (~contentType.search(/json/)) {
if (contentType && ~contentType.search(/json/)) {
try {
data = JSON.parse(xhr.responseText);
}
catch (e) {
// pass...
}
}
else if (~contentType.search(/xml/)) {
else if (contentType && ~contentType.search(/xml/)) {
data = xhr.responseXML;
} else {
try {
data = JSON.parse(xhr.responseText);
} catch (e) {
data = xhr.responseText;
}
}

callback.call(xhr, xhr._spy, {
Expand Down

0 comments on commit 34aceeb

Please sign in to comment.