File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,16 @@ public function getUrl()
159159 );
160160 }
161161
162+ protected function adjustRootEndpoint ($ path )
163+ {
164+ $ root = $ this ->config ->getRootEndpoint ();
165+ if (0 !== strpos ($ path , $ root )) {
166+ $ end = strrpos ($ path , $ root ) + strlen ($ root );
167+ $ endpoint = substr ($ path , 0 , $ end );
168+ $ this ->config ->setRootEndpoint ($ endpoint );
169+ }
170+ }
171+
162172 /**
163173 * Gets the scheme, such as http or https.
164174 *
@@ -549,6 +559,8 @@ private function parse($uri)
549559 throw RestException::invalidEndpoint ($ this ->parsedUri ['path ' ]);
550560 }
551561
562+ $ this ->adjustRootEndpoint ($ this ->parsedUri ['path ' ]);
563+
552564 $ this ->parsedUri ['path ' ] = str_replace ($ this ->config ->getRootEndpoint (), '' , $ this ->parsedUri ['path ' ]);
553565 $ this ->parsePath ($ this ->parsedUri ['path ' ]);
554566
You can’t perform that action at this time.
0 commit comments