eksi-sozluk
Advanced tools
Comparing version 0.0.12 to 0.0.13
var debug = require('./debug')('request'); | ||
var request = require("request"); | ||
var https = require("https"); | ||
@@ -9,3 +9,4 @@ module.exports = withOptions; | ||
var options = { | ||
url: url, | ||
host: 'eksisozluk.com', | ||
path: url, | ||
followRedirect: false, | ||
@@ -18,4 +19,3 @@ headers: { | ||
var qs = url.match(/\?([\w\=\&]+)/), | ||
hostname = url.match(/(\w+:\/\/[^\/]+)/)[1]; | ||
var qs = url.match(/\?([\w\=\&]+)/); | ||
@@ -26,8 +26,7 @@ qs = qs ? '?' + qs[1] : ''; | ||
return request(options, function(error, response, body){ | ||
function done(error, response, body){ | ||
var redirect; | ||
if(response && response.headers.location){ | ||
redirect = hostname + response.headers.location + qs; | ||
redirect = 'https://eksisozluk.com' + response.headers.location + qs; | ||
debug('Redirecting to: ', redirect); | ||
@@ -48,3 +47,21 @@ withOptions(redirect, callback); | ||
}); | ||
}; | ||
https.request(options, function (response) { | ||
var str = ''; | ||
//another chunk of data has been recieved, so append it to `str` | ||
response.on('data', function (chunk) { | ||
str += chunk; | ||
}); | ||
response.on('error', function (error) { | ||
done(error); | ||
}); | ||
//the whole response has been recieved, so we just print it out here | ||
response.on('end', function () { | ||
done(undefined, response, str); | ||
}); | ||
}).end(); | ||
} |
@@ -1,3 +0,3 @@ | ||
var TEMPLATE = 'https://eksisozluk.com/{0}?p={1}', | ||
STEMPLATE = 'https://eksisozluk.com/autocomplete/query?q={0}', | ||
var TEMPLATE = '/{0}?p={1}', | ||
STEMPLATE = '/autocomplete/query?q={0}', | ||
format = require("new-format"); | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "eksi-sozluk", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "NodeJS client to query Eksi Sozluk", | ||
@@ -10,6 +10,5 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "fox" | ||
"test": "fox -t 5000" | ||
}, | ||
"dependencies": { | ||
"request": "*", | ||
"new-format": "0.0.1", | ||
@@ -16,0 +15,0 @@ "anglicize": "0.0.0", |
@@ -1,2 +0,2 @@ | ||
## eksi-sozluk | ||
## eksi-sozluk [![Build Status](https://travis-ci.org/azer/node-eksi-sozluk.png?branch=master)](https://travis-ci.org/azer/node-eksi-sozluk) | ||
@@ -3,0 +3,0 @@ NodeJS client to query Eksi Sozluk |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
12407
10
17
279
2
1
- Removedrequest@*
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.10.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedverror@1.10.0(transitive)