Giter Site home page Giter Site logo

HTTP Networking Module about spiderfire HOT 5 OPEN

redfire75369 avatar redfire75369 commented on May 23, 2024 2
HTTP Networking Module

from spiderfire.

Comments (5)

lino-levan avatar lino-levan commented on May 23, 2024 1

Once web streams land in spiderfire, I'd be interested in seeing fetch implemented.

from spiderfire.

gimbling-away avatar gimbling-away commented on May 23, 2024

How do importing other files currently work in spiderfire?

I propose a syntax like

let request =  http.get("https://my.dopeapi.dev/get", {"headers": {"Authorization": "my_token"}});
console.log(request.response);

and we could also implement an HTTP handler for more efficient handling of multiple http requests

let handler = http.newHandler();
handler.get(...);
handler.delete(...);

I'd also recommend the ureq crate -- https://lib.rs/ureq

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 23, 2024

Importing is currently along the lines of

import fs from "fs";
import {get} from "./http.js";

Both of those methods (directly sending a request) and creating a request handler/agent to request without passing the options every time are planned.

I was planning to use hyper, but I can definitely take a look at ureq. My main issue with ureq is probably the lack of an asynchronous API.

from spiderfire.

pi0 avatar pi0 commented on May 23, 2024

Looking forward for this to early try for Nitro (unjs/nitro#1781) and Nuxt!

from spiderfire.

Redfire75369 avatar Redfire75369 commented on May 23, 2024

To be precise, there's already a basic implementation of fetch, mostly in favour of a http client module. The main caveat being it doesn't support streams.
You can see roughly what's supported here: fetch.d.ts

from spiderfire.

Related Issues (20)

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.