Forum Discussion

cshannahan_3137's avatar
cshannahan_3137
Icon for Nimbostratus rankNimbostratus
Sep 11, 2018

Help with POST Content Length HTTP Monitor

Hello, this is what I have for a POST. When the content length is 0 I get a 200 back. When it's something else I get 415 unsupported media type. I'm not sure if there's something wrong with the way it's written or if I just have the wrong content length in there. The application guys are stating the 0 is causing some weird errors in the logs so I'm trying to get a 200 back with the proper length.

 

POST /api/ChunkingService/CacheChunk HTTP/1.1\r\nHost: obcs.uat.alc.ca\r\nConnection: /\r\nContent-Length: 0\r\nContent-Type: application\json\r\n\r\n{\"TerminalId\":\"LBTest\",\"Value\":\"_\",\"RetailerId\":99999999}

 

  • Hi,

    Did you try with real content lenght:

    {"TerminalId":"LBTest","Value":"_","RetailerId":99999999} --> Your string is 57 characters long.

    POST /api/ChunkingService/CacheChunk HTTP/1.1\r\nHost: obcs.uat.alc.ca\r\nConnection: /\r\nContent-Length: 57\r\nContent-Type: application\json\r\n\r\n{\"TerminalId\":\"LBTest\",\"Value\":\"_\",\"RetailerId\":99999999}
    

    Try this and if you obtain an error did you have the possibility to check app logs?

    For calculate lenght you can do it online or use an irule:

    set recv_data "{\"TerminalId\":\"LBTest\",\"Value\":\"_\",\"RetailerId\":99999999}"
    log local0. "AAA1: [string length $recv_data]"
    

    We obtained: AAA1: 57

    regards,

  • I guess the value may be 57

    %set test "{\"TerminalId\":\"LBTest\",\"Value\":\"_\",\"RetailerId\":99999999}"
    {"TerminalId":"LBTest","Value":"_","RetailerId":99999999}
    % string length $test
    57