18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Issue with HEAD HTTP request

tdeblocktdeblock Members
edited January 2015 in Sahi - Open Source
Hello,

I have an critical issue with Sahi. My application use HEAD HTTP request to know if I can do Ajax request.
Without sahi, all is ok.
But when i activate sahi ajax call is not do.

I have found why. It's because when a HEAD HTTP query is do sahi return a mocked header repsponse, not the header retourned by the server.

This is the header when sahi is not running : http://hpics.li/37a32b9
This is the header when sahi is running : http://hpics.li/394dc79

I have correct the issue. For that I have update the net.sf.sahi.request.HttpRequest class :
- I have add a method :
public boolean isHead() {
return "head".equalsIgnoreCase(method());
}
- i have update the if line 86 :
before :
if (isPost() || isGet() || isPut() || isDelete() || isConnect()) {
setHostAndPort();
setUri();
setQueryString();
}
after
if (isPost() || isGet() || isPut() || isDelete() || isConnect() || isHead()) {
setHostAndPort();
setUri();
setQueryString();
}

My correction is do on the v5 release.

Comments

  • narayannarayan Administrators
    Hi,
    Your solution is correct. We recently added it in Sahi Pro 6. We will incorporate this in our next OS release.
    Thanks a lot for sharing.
    Regards,
    Narayan
Sign In or Register to comment.