Forum Discussion

HankLiu_159320's avatar
HankLiu_159320
Icon for Nimbostratus rankNimbostratus
Sep 03, 2014

Can you return a status code without content or location?

Hello

 

Can I throw a http response code without any location or content?

 

e.g. HTTP:response 400

 

Would this be syntactically legal or will it throw some error during runtime? I wasn't able to find a good example on this. Thanks!

 

  • According to the RFC, status code of 400 does not require any further 'meta-information' to be provided.

     

  • Sorry, I'm getting emails telling me you have responded but I just can't see them here for some reason.

     

  • I don't see why something like

    HTTP::respond 400
    

    wouldn't work. You could refine it somewhat by specifiying a HTTP version

    -version 1.1
    

    and also prevent a Server header being sent using

    noserver
    

    but I'd hope it would work just fine with HTTP::respond 400