简体   繁体   中英

When we pass # instead of an Integer in url path parameter , why does it accept '#' in place of an Integer?

while doing get operation in spring boot application, like api/getbooks/1 : it fetches the first record. for api/getbooks/@ : gives invalid parameter. but api/getbooks/1# : gives the same result as api/getbooks/1. how can i make it not to accept #?

In the article of URL fragments on Wikipedia can find

The fragment identifier functions differently to the rest of the URI: its processing is exclusively client-side with no participation from the web server, ... When an agent requests a web resource from a Web server, the agent sends the URI to the server, but does not send the fragment

So that is basically the intended behavior the # and everything afterwards is not sent to server. So the URL server gets is the same for both queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM