Good afternoon,
I have same problem somebody in this topic -> https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/jsapi-4-requesting-wrong-url-when-loading-wms-from/td-p/1058917 had.
I create a simple WMSLayer({url: url}) and under the hood SDK replaces that url with some other url which is retrieved from WMS's GetCapabilities.
ArcGIS API for JavaScript (legacy) 3.X didn't have this problem. I see this new functionality as a regression..
What are your thoughts about it? Any plans to improve WMS constructor?
Theoretically I can use esriConfig.request.interceptors and change url in "before" method, but the problem is that you have to hardcode url you need to replace. I mean just look at https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/jsapi-4-requesting-wrong-url-when-loading-wms-from/td-p/1058917 -> It is bad practice to hardcode host and url as was done in that case... And in my case I have big amount of WMS layers...
Could you improve your SDK by adding interceptor to layer's constructor maybe so that it acts on current layer only?? I think that should help in such cases..