dengliming commented on code in PR #672:
URL: https://github.com/apache/shenyu-dashboard/pull/672#discussion_r4111385727


##########
src/routes/Document/components/ApiDebug.js:
##########
@@ -271,8 +272,7 @@ const FCForm = forwardRef(({ form, onSubmit }, ref) => {
               style={{ width: "40%" }}
               onChange={(envId) => {
                 const env = Object.values(envProps)[envId];
-                const url = new URL(env.addressUrl);
-                const host = `${url.protocol}//${url.hostname}:${url.port || 
"80"}`;
+                const host = buildEnvironmentHost(env.addressUrl);

Review Comment:
   [P2] Allow default-port URLs in the form validator when removing the 
explicit port
   
   buildEnvironmentHost() now produces URLs such as 
https://api.example.test/orders, but the requestUrl rule at line 266 still 
requires an explicit :port: /^https?:\/\/([^:]+):(\d+)(\/.+)$/. 
validateFieldsAndScroll therefore rejects the newly generated URL before either 
Send or Save can proceed. This leaves the HTTPS case in #629 unusable and also 
regresses default-port HTTP environments, whose generated URLs previously 
included :80. Explicit default ports do not work around this because URL.host 
normalizes them away.
   
   I reproduced this through the actual form submission path: both default-port 
HTTP and HTTPS were blocked, while HTTPS on port 8443 submitted successfully. 
Admin's SandboxServiceImpl already resolves omitted ports through 
UriUtils.getActualPort(), so an explicit port is not required by the backend 
contract. Please update the validator to accept valid HTTP(S) URLs with 
optional ports and add form-level submission coverage, rather than testing only 
the host-building helper.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to