setHttpHeader overwrites the header instead of adding new one
-
Hey,
I am looking into some networking with HISE and found a bug regarding the headers.Server.setHttpHeader
does not add a header but instead overwrites the last one resulting on only one header being sent.In this example:
Server.setHttpHeader("Content-Type: application/json"); Server.setHttpHeader("Header1: I am header 1 and get overwritten"); Server.setHttpHeader("Header2: I am header 2 ");
only the last
Header2
is being sent to the Server instead of all 3.I've set up a python testing server that prints out the header and the payload you can easily run it locally with
$python3 debugHeaders.py
.This exposes a route called /test/ which I call in my snippet:
HiseSnippet 918.3ocsV01aaaCDlxIpnV6ErBze.D4KwAvwVNwMMMEaq0NNqFqIwnJsqeKflh1hKTjBjTIynH+71+m9On6njieo0Hs0.SePV2KOmdtS2czCzJJyXTZjW0KljwPd+nezDoMoaBgKQ8OF48y9mRLVlFWppyjLhwvhQdda7GNEdU2DUb8weuCQPjT1bUHz6TbJ607Ttct1Au3O4BwIjX1E7zE7t8K5SUxtJgJG3yF9gnLB8JxX1YDmaU7QdOnWL2pzQVhkY.e5nhmDkntQV5+63F9PAyIzBEAApTMpaBWDO3tb0fPdaNXdluQYl+X+S4w7Y5mWA9kBC34HVrF3U49nTquCJ4s.k1rjROxOhp4Y14Vb74G76KgOHiHPodQpT5Kpx+VwuqB7PZajRthchFDlgn1Agg0wvscddPPyl3bCCaS3FLWhopzgbIwxUR7MbaBFbn5t+FNwZyLG0r4Xtw1XLXHeXCv2lJyUDsIo4SG0dexyFEGGRdV7A6eX7gGreaJkzd3SHzC2qcP.7c0XwcdYTuKe6adM9WwaKTThHQYrG0NLLb6mGfChX5qY5FFlsCwv.+pcG.fqX7hN7JfQuhAcP5ZaMMW20UxNBSxxDbZQNz7uMJ4V.1Uiq72VGg6iIo3jBIbKLQFiGyrXE.4FM2Bw9qEi8VNF6gc.B.dYTBViLMWZqscWhPvkiwyR7scNMMrfJweAE1AmGcQssZBcR1spi+vs0wixkTWxTy.MX4l5XMyjAQlsC9CAUqt7KozGHtetAq18oeFTmG2B2tsZvcwGqjmorryk01I.BbvsA3O2znQqzlq9qUBATOVkY2Lt99.VSlmNjoqiulHxYybDFBVdx5AeaSVzx1gEbTI6K41yyXSkOQIhcSLtm+x4Pzz9I3o21+Xhk3FMmpC7KiosbGc7NlcMraqbPsp+wLyUVUFrc6Klhg8Gp3bAwt7RE21yoFf5wRSxtoUogamr310uiMMg26lluUJ9H+AbKMY0brxJ3HTo9+fiS2O+S98FMhQsyI3l9m790cY7W40+FUtElVOkX07+A44eVdZDbrDkAucojIff66Uw0sTJG5jcUfHlLtP3Sv0TisbxdSM15NinTBUqtjVNE3NA3gEZ.NIKNvqJbxKHiagJlL.b9gMBQovgQWRotzeWnAd0X1aMvr+Zfo8Zf4IqAlCVCLOcMvb38hw8+.dYtUkVNN.JFzqXEgmWOIA5rJ5BQ+WDv7I0
-
That's intentional (so that you can use different headers for subsequent calls), just put all three into a single string with new line characters.
-
@Christoph-Hart Thanks for letting me know!
-
-
-
@Christoph-Hart I've looked further into the Server component and it seems like HISE always adds a trailing slash at the end of the route. So
Server.callWithPOST('localhost:4000/test', p, function(status, reponse){});
actually calls the /test/ route and not the /test one which ends up in a 404.
Is there a trick to not add a trailing slash in hise?