Giter Site home page Giter Site logo

web-request's People

Contributors

alikhil avatar davetemplin avatar lookfirst avatar maghis avatar ps-davetemplin avatar tichau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

web-request's Issues

Typescript compile errors

Typescript version: 1.8.10 (should be the same for typescript < 2)
Web-request version with compile errors: 1.0.7
Last working web-request version: 1.0.6

Errors:

./node_modules/web-request/index.d.ts
Error:(150, 25) TS1110:Type expected.
Error:(150, 25) TS7008:Member 'null' implicitly has an 'any' type.
Error:(177, 5) TS2300:Duplicate identifier 'readonly'.
Error:(177, 14) TS1005:'=' expected.

random.ts
Error:(43, 38) TS2339:Property 'content' does not exist on type 'Response<string>'.

1.0.6 and 1.0.7 have different index.d.ts file

Additional info: error on typescript 1.8.10 from node_modules, system version of typescript - 2.0.3

es5 distro

Would it be at all possible to have a es5 redist so as to be friendly with projects like create react app?

Question: am i using it correctly with multiple hedaders? headers [ {..}, {..} ]

I want to pass 2 headers so I tried:

    const deployRequest = await WebRequest.stream('https://myurl',
        {
            method: 'post',
            headers: [
                {'Content-Type': 'application/zip'},
                {'Authorization': `Bearer ${apiKey}`}
            ]
        });
    fs.createReadStream(zippedSite).pipe(deployRequest);
    const deployResponse = await deployRequest.response;

i'm not sure i'm using the correct format for request headers since i get: 401 Unauthorized and if i use the same headers with curl all is ok.. anything i'm doing wrong?

request.default does not return a wrapper

Hi,

in the request implementation, cqlling request.default returns you a wrapper that you'll use to issue your next requests using those defaults.

In web-request, calling default only calls request.default and returns void.

Working with Cookies

Hi,

I am struggeling with using web-request and cookies. It surely is simple to have web-request activate and return cookies, but I can't seem to get it to use/send the cookie on the follow-up request. Simply sending another request via web-request does not seem to work (no cookie at the server side). The "best" I could get is an error 400 with "Invalid cookie handler" when I try sending the received cookie as header with the next request.
In exploring using cookies I also wondered, if there is a way to access the request.jar() method via web-request to create a new jar for cookies, as mentioned in the description of the request module. Or do I have to implement my own jar on CookieJar?

Thanks for any advice,
Stefan

Cannot find type names

I keep getting this error when compiling my Angular 2 project:

ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (1,23): Cannot find module 'http'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (2,26): Cannot find module 'stream'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (103,40): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (105,82): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (106,19): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (111,16): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (158,11): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (159,12): Cannot find name 'Buffer'.
ERROR in /Users/user/workspace/app/client/node_modules/web-request/index.d.ts (161,10): Cannot find name 'Buffer'.

I get this after running:

npm install --save web-request
npm install @types/node

When I view the code in web-request/index.d.ts in my code editor there is no error; it just shows up in compilation.

Node version: v6.11.3

Handling timeouts

Hello, I was curious about how you would recommend handling errors using this package that come from the timeout being reached?

Thank you!

cannot find module 'http' etc.

error

node -v   v6.10.1
@angular/cli: 1.4.3
node: 6.10.1
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.3
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4

Any suggestions? is this library good for typescript angular work?

User-agent ignored in WebRequest.defaults

WebRequest.defaults({ headers: {'User-Agent': 'curl/7.28.1'} });
var data = await WebRequest.get('http://localhost');

The request made over the wire:

GET / HTTP/1.1
host: localhost
Connection: close

What am i doing wrong? User-Agent doesn't make it in..

Using web-request 1.0.7 from npm.

how to use WebRequest to post JSON data

import * as WebRequest from 'web-request';

(async function () {
var data = {
"id": 5,
"title": "json-server5",
"author": "typicode5"
};
await WebRequest.post('http://192.168.22.10:3000/posts', {headers: {'Content-Type': 'application/json'}}, data);
})();

I try to use WebRequest post JSON data with above code.
but always get fatal error:

(node:45899) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Argument error, options.body.
_http_outgoing.js:456
throw new TypeError('First argument must be a string or Buffer');
^

TypeError: First argument must be a string or Buffer
at ClientRequest.OutgoingMessage.write (_http_outgoing.js:456:11)
at Request.write (/Users/martinsun/node_modules/request/request.js:1514:27)
at end (/Users/martinsun/node_modules/request/request.js:552:18)
at Immediate. (/Users/martinsun/node_modules/request/request.js:581:7)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)

Would you please let me know how to fix the problem?

Webpack fails to compile at the UglifyJS step due to `function*` syntax

Running

ng serve --prod -sm

with my Angular 2 app produces the following error:

ERROR in vendor.6cd5e9b8eaa69eb62924.bundle.js from UglifyJs
Unexpected token operator «*», expected punc «(» [/Users/user/workspace/app/client/node_modules/web-request/index.js:13,0][vendor.6cd5e9b8eaa69eb62924.bundle.js:60875,51]

which means that UglifyJS is reaching web-request's function* syntax and freaking out. Compilation works perfectly fine on development (I assume because UglifyJS isn't being run), but I cannot get my production build to work unless I use something other than web-request.

Cant use named import for delete

Hi, I have been using your wonderful module recently and I noticed that if i try and use the delete functionality as a named import it wont compile as delete is a reserved word in javascript. For example

import {json, delete} from 'web-request';

The above throws an error because of the name "delete". Is it possible to rename this to something that is not a reserved word?

I should note that the below works, however I really like having named imports, I feel its a lot cleaner

import WebRequest from 'web-request';

WebRequest.delete('http://bla.com/bla');

Did you plan to release a new version?

Hi,

Sorry, the issue is not the best format to ask that but I didn't thought of a better way.

Did you plan to release a new version with the already integrated modifications in master?
I have some dependencies on it so I built it myself but I need to work with someone else on the project, so it'll be simpler to release it to everyone ^^.

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.