Comments (4)
Hi @simonhamp, thank you for your comments, I really appreciate it!
I'll start off with saying I really like this idea. I don't know a huge amount about PSR-7 (I think is the right PSR) but I do know that Guzzle follows it quite well. I'd like in the future to be able to make swappable clients for Saloon so you can easily build your own Saloon clients/adapters that it uses under the hood.
The main request flow for Saloon is as follows:
- Request is created and sent method is called
- Request goes to request manager
- RequestManager builds up and merges headers, config, interceptors and handlers defined on both the request and the connector
- RequestManager converts it to a Guzzle response
- Guzzle sends the request
- Saloon receives the response
- Saloon sends you the response
I think Saloon could replace the RequestManager
with a SaloonClient
, with the default being GuzzleClient
. Inside of the client, it would be responsible for building up the request, but it would have access to:
- All the merged headers, config, handlers and interceptors
- The request URL
- The ability to create a Saloon response
That way, you would be able to create any client you like and apply the headers/config/handlers in whichever way the client supports it. If a particular client didn't support middleware/handlers like Guzzle does, maybe you can specify that in the client so Saloon would know to disable that particular feature.
What are your thoughts?
I feel that this would take Saloon to the next level, from being a Guzzle wrapper to being the "Flysystem" of HTTP integrations. As exciting as this is, I'm happy to leave it dependant on Guzzle for the next few months at least, because it's really solid so far, and then as it matures I hope to use this client pattern. I've got a couple of things I want to build in Saloon first like mocking and caching. Once I've built that - I'll say Saloon is ready for version 1.0, after that I'll look into making it pluggable.
from saloon.
Totally agree! Only build it if/when it's needed.
Regardless, I'm looking forward to using this package soon
from saloon.
Sounds great! Iβll happily keep this issue open for now so others can know itβs on my mind.
Hope you have fun with it!
from saloon.
I will convert this into a discussion to move it away from the issues page π
from saloon.
Related Issues (20)
- Paginator Next Request URL help HOT 5
- Create commands not respecting config file HOT 4
- Dots in parameters get converted to underscores because of parse_str HOT 7
- Refresh token with Client Credentials Grant HOT 5
- Faking a response - failed to match url HOT 2
- Cannot Have Request with `headers` HOT 4
- Skipping authentication when request is cached HOT 5
- Skipping AuthenticatePendingRequest when fetching a new accessToken using OAuth2 plugins HOT 2
- OAuth2 - Method not allowed (405) when getting the access Token HOT 8
- Missing methods updates for MockResponse HOT 1
- ERROR There are no commands defined in the "saloon" namespace. HOT 1
- Rate Limit Plugin: Issue with 'allow(1)->everySeconds(1)->sleep()' Exceeding One Request per Second
- Inteliphense cannot recognize the merge() method on request HOT 3
- Connector default headers overwrite request body headers
- Remove authentication on a specific request HOT 1
- Some properties are removed from the response body
- Using non-standard HTTP methods HOT 2
- Generating Documentation Files for GPT on ChatGPT
- Tests using Fixtures with custom Authenticators record incorrect response HOT 1
- async request with multi connector
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from saloon.