@@ -4039,30 +4039,30 @@ bool fetch(JSContext *cx, unsigned argc, Value *vp) {
4039
4039
}
4040
4040
4041
4041
RootedString backend (cx, Request::backend (request));
4042
- if (!backend && builtins::Fastly::allowDynamicBackends == false ) {
4043
- backend = builtins::Fastly::defaultBackend;
4044
- }
4045
- if (!backend && builtins::Fastly::allowDynamicBackends == false ) {
4046
- size_t bytes_read;
4047
- RequestHandle handle = Request::request_handle (request);
4048
- UniqueChars buf (
4049
- read_from_handle_all<xqd_req_uri_get, RequestHandle>(cx, handle, &bytes_read, false ));
4050
- if (buf) {
4051
- JS_ReportErrorUTF8 (cx,
4052
- " No backend specified for request with url %s. "
4053
- " Must provide a `backend` property on the `init` object "
4054
- " passed to either `new Request()` or `fetch`" ,
4055
- buf.get ());
4056
- }
4057
- return ReturnPromiseRejectedWithPendingError (cx, args);
4058
- }
4059
-
4060
- if (!backend && builtins::Fastly::allowDynamicBackends) {
4061
- JS::RootedObject dynamicBackend (cx, builtins::Backend::create (cx, request));
4062
- if (!dynamicBackend) {
4063
- return false ;
4042
+ if (!backend) {
4043
+ if (builtins::Fastly::allowDynamicBackends) {
4044
+ JS::RootedObject dynamicBackend (cx, builtins::Backend::create (cx, request));
4045
+ if (!dynamicBackend) {
4046
+ return false ;
4047
+ }
4048
+ backend.set (builtins::Backend::name (cx, dynamicBackend));
4049
+ } else {
4050
+ backend = builtins::Fastly::defaultBackend;
4051
+ if (!backend) {
4052
+ size_t bytes_read;
4053
+ RequestHandle handle = Request::request_handle (request);
4054
+ UniqueChars buf (
4055
+ read_from_handle_all<xqd_req_uri_get, RequestHandle>(cx, handle, &bytes_read, false ));
4056
+ if (buf) {
4057
+ JS_ReportErrorUTF8 (cx,
4058
+ " No backend specified for request with url %s. "
4059
+ " Must provide a `backend` property on the `init` object "
4060
+ " passed to either `new Request()` or `fetch`" ,
4061
+ buf.get ());
4062
+ }
4063
+ return ReturnPromiseRejectedWithPendingError (cx, args);
4064
+ }
4064
4065
}
4065
- backend.set (builtins::Backend::name (cx, dynamicBackend));
4066
4066
}
4067
4067
4068
4068
size_t backend_len;
0 commit comments