-
Notifications
You must be signed in to change notification settings - Fork 743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Networking Beta: Convenience constructors for HTTPRequest and JSONRequest #1404
Comments
The override is the correct way of doing this - I'm not quite clear why the |
When looking for a way to get my Therefore i have implemented a custom interceptor to replace the original If there is something i have misunderstood or a better approach to achive this i'm glad to get enlighted. |
OK! I think I see what the problem is here: While the It sounds like the issue is that there needs to be a way to specify the request type that's customizable at that level, so that you can actually use the custom type you've created. Does that sound accurate? I'm gonna poke at some ideas on this. |
Indeed, if subclassing |
Wow i didn't mean to ask for moving mountains but opening |
Haha, this worked as designed: You pointed out that I hadn't provided an access point to something, so I added it. Then by adding it I realized something else that was annoying me could change. 😇 |
With 0.34.0-rc.2 i was able to implement a clean and simple solution to my use case. |
In my use case i have to append to the
URLRequest.query
before a request is actually sent and that was fairly straight forward with the old network stack usingHTTPNetworkTransportPreflightDelegate.networkTransport(_:willSend:)
With the new network stack things have gotten a bit more complex but i was able to come up with a solution involving a custom
ApolloInterceptor
that turns a givenJSONRequest
into a custom subclass which overridestoURLRequest()
.So to make implementation of custom HTTPRequests more easy i suggest you to add some convenience constructors for
HTTPRequest
andJSONRequest
that take a single argument of their own type. This would let me get rid of this bunch of constructor arguments like this:instead of this:
The text was updated successfully, but these errors were encountered: