httpclient - Apache HTTP Client returns status code as 200 instead of 404 for a web url -


i using apache http client 4.5.3 response code of following web url:

https://roofandfloor.com/chennai/atvarika-kelambakkam/pdp-j?index=16&s=y2l0et1dagvubmfpjmxvy2fsaxrpzxm9s2f6aglwyxr0dximchjvcgvydhluexblcz0xjmjlzhjvb21zptqlmkimc29ydhbhcmftpxjlbgv2yw5jzq%3d%3d

when open above url using browser, page not found error.

but when try retrieve response code of url using http client 4.5.3 response code 200 instead of 404.

below code:

public static void main(string[] args) throws clientprotocolexception, ioexception {     string pathurl="https://roofandfloor.com/chennai/atvarika-kelambakkam/pdp-j?index=16&s=y2l0et1dagvubmfpjmxvy2fsaxrpzxm9s2f6aglwyxr0dximchjvcgvydhluexblcz0xjmjlzhjvb21zptqlmkimc29ydhbhcmftpxjlbgv2yw5jzq%3d%3d";     closeablehttpclient client = httpclientbuilder.create().build();     httpresponse response=null;     int statuscode=0;     httpget request =new httpget(pathurl);     response = client.execute(request);     statuscode = response.getstatusline().getstatuscode();     system.out.println(statuscode); } 

please note: occasionally(1 out of 10 runs) above program returns status code 404.

please advice.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -