Sketch of new Request(Proxy(Request))#6730
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@vicb ... this won't work anyway until the more general issue of wrapping jsg::Object's with proxies is addressed. |
| fetcher = oldRequest->getFetcher(); | ||
| signal = oldRequest->getSignal(); | ||
| } | ||
| KJ_CASE_ONEOF(p, jsg::Proxy<RequestProxy>) { |
There was a problem hiding this comment.
Instead of reproducing all this logic here, it would be nice if we could delegate to the existing RequestInit path. Only the url needs special handling.
Otherwise it's easy to forget to add new properties here.
| void validate(jsg::Lock&); | ||
| }; | ||
|
|
||
| struct RequestProxy { |
There was a problem hiding this comment.
Can we possibly use RequestInit here instead of declaring a new type? It seems ugly that we'd have to extend this type later.
I guess the only problem is that RequestInit doesn't include url. Though maybe it could -- just declare it optional, and ignore it except in the proxy case?
Relately, I see you dismissed Bonk's comment pointing out that cache and encodeResponseBody are missing, but that does seem like an actual problem, no?
There was a problem hiding this comment.
Dismissed to reduce a small amount of noise in the discussion. Already planning to account for both of we decided that this was a worthwhile approach.
A skech of an approach to addressing #6700
This is not quite functional yet due to a limitation with handling jsg::Objects through the lens of JSG_STRUCT... well, more limitation of handling jsg::Objects through Proxy:
This is a different problem tho. The sketch shows how we can make
new Request(Proxy(Request))work in general.