Skip to content

Custom HTTP headers?

I'm doing some stuff with post data, and need to include a custom http header along with the request, specifically 'X-AjaxPro-Method: ServerSideSaveTopic'. Is there any way I can manually set this in the engine script? The closest I could find in the docu was 'form request with=' but that only affects the X-Requested-With header.

Comments

  • Something like:

    add http header=X-AjaxPro-Method=ServerSideSaveTopic

    to pair with post data= would be awesome!


  • SvenSven www.GSA-Online.de
    hmm right now there is no way to do this. I never thought it would be required. Never heared of a site that would rely on custom headers send by a browser. Is it really required?
  • Yeah it seems to be a feature of the AjaxPro framework http://ajaxpro.codeplex.com/
    The headers get sent as part of the ajax request when submitting json data. Took me a while to work out that the custom header was required!
  • SvenSven www.GSA-Online.de
    I will try to add that automatically if the post data is json like.
  • That would be cool, thanks Sven. Though that header might not be needed for all sites that use json data; in the future, some sort of syntax to manually add http headers might be more elegant :)
  • Hey @Sven, did you have a chance to add anything like this? I've seen a few script engine updates in the changelog, such as 'improved minor parts of submission' on 8.54 but am not sure if it related to this. I've found a couple more sites/platforms that use a http header to send instructions (all ajax related), so it should be a useful feature for future engines.
  • SvenSven www.GSA-Online.de
    The one from original post should be added automatically.
  • Thanks Sven! So theoretically, this code should invoke the header?

    modify url=/mysubmiturl.php
    post data={"somejson":data,"goes":"here","myarticle":"%article%"}
    encode post data=0
    just download=1

    It might be useful for it to show what headers are sent with each request in the debug window too.
  • SvenSven www.GSA-Online.de

    Yes it should send that. However I couldn't test it as I had no engine using it.

    Yes I might have to change this thing later on if n´more custom header are set by script. In that case I will add debug data.

  • I'm finding it difficult to get this working in SER, though I can copy the same POST request and send it via Perl or via http://hurl.it with no problems. Does SER send a 'Content-Length' header? I think this may be needed when submitting JSON data.
  • SvenSven www.GSA-Online.de
    of course it sends content-length as thats required by every post packet.
  • Yep of course, sorry, was clutching at straws I guess.
Sign In or Register to comment.