Giter Club home page Giter Club logo

http-please's People

Contributors

nanotime avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

http-please's Issues

Add more testing

Is your feature request related to a problem? Please describe.
The lib need more test coverage

formatUrl as a chain plugin

Is your feature request related to a problem? Please describe.
FormatUrl should be a chain plugin instead an internal private use. At this moment formatUrl is a plugin used internally that only return a string, not a chain.

Describe the solution you'd like
I want to create the first plugin as an example, it has to be importable and it has to be added in the construction of the instance instead of being directly included in the execution, something like this:

import CreateHttpPlease from '@nanotime/http-please;
import { query } from '@nanotime/http-please/plugins';

const http = CreateHttpPlease({
  url: 'https://example.com',
  options: { ... },
  plugins: [
    query,
  ]
})

const getSomething = async () => {
  const request = await http.query({ foo: 'bar' }).get({ path: '/baz' });
 return reques.data
}

Describe alternatives you've considered

Additional context

Related with #17

Fetch Instance

Is your feature request related to a problem? Please describe.
The plugin need an inner full fetch instance to use internally on the different methods. This allows the users to use full vanilla fetch if they want and create inner instances with their own config.

Describe the solution you'd like
The method could be used like:

const instance = new HttpPlease({ ... });

instance.fetch(url, options); // using the full fetch API.

Describe alternatives you've considered
...

Additional context
This is primarily for better dev experience and sensibility.

Add types

Is your feature request related to a problem? Please describe.

This library need to be typed to be used accordingly in TS projects, but at this moment is written in Vanilla JS.

Describe the solution you'd like

The solution I'll like is to create a declaration file and keep the JS code as it is.

Here is a draft for the d.ts file

Describe alternatives you've considered

I also considered a TS migration but not sure of it.

Additional context

The biggest problem here is how to type the plugins system since that feature is pretty open. A plugin is only a function that returns an object, that object is injected on the instance creator and it can be whatever you need this is an optional plugin example and this is a more complex one.

Truth is that this structure is really flexible and useful to extend the library but a pain to type, so maybe a refactor of the plugin system for a more structured way would be a solution for this.

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Cannot push to the Git repository.

semantic-release cannot push the version tag to the branch main on the remote Git repository with URL https://x-access-token:[secure]@github.com/nanotime/http-please.git.

This can be caused by:


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Add plugins support

Is your feature request related to a problem? Please describe.
This library needs a flexible plugins system to extends functionality.

Describe the solution you'd like
A plugin system like this one:

const instance = new HttpPlease({ url, options, plugins: [pluginA, pluginB, pluginC] });

instance.get(...).pluginA().pluginB().pluginC();

Describe alternatives you've considered
I'm thinking on extend this just with functions that consimes this context on the Class.

Additional context
Need more research.

Js classes MDN

Migrate TS to JS

Is your feature request related to a problem? Please describe.
Don't find any real use for TS in this library

HttpPlease.query doesn't chain correctly

Describe the bug
Query method is doing the correct job but is not chaining correctly on the prototype,, trying to use it as expected triggers an error like:

Uncaught TypeError: http.query(...).get is not a function

To Reproduce
Steps to reproduce the behavior:
Just try to call any prototype method after .query and you'll get the error.

Expected behavior
It should configure the query string for you and inject it into the URL

Screenshots
N/A

Error exporting plugins.

Describe the bug
Wrong exporting on plugins multi entry points

To Reproduce
Steps to reproduce the behavior:

  1. Just try to import query plugin, it fails.

Expected behavior
It should import the function.

Screenshots

Desktop (please complete the following information):

  • OS: Windows
  • Browser any
  • Version any

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Request interceptors only exposes Response object

Describe the bug
Request interceptor is exposing the response object.

To Reproduce
Steps to reproduce the behavior:

  1. Create a request interceptor
  2. Log the config object

Expected behavior
It should log the configuration you have on the instance and request, not the response

Resolver selector

Is your feature request related to a problem? Please describe.
The lib needs the capacity to select the method response resolver, can be any of the Response methods defined in fetch documentation

Describe the solution you'd like

interface HttpPlease {
  ur: URL;
  options: RequestInit
  resolver: string;
}

new HttpPlease({
...
resolver: 'json'
})

Additional context
Response Class

Create a multi entry point structure

Is your feature request related to a problem? Please describe.
This project is meant to have some default importable plugins but it need a different configuration for that.

Describe the solution you'd like
This article can be useful

Describe alternatives you've considered

Additional context

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.