function callback()

in docker/build_artifacts/sagemaker/tensorflow-serving.js [73:88]


    function callback (reply) {
        var body = reply.responseBody
        if (reply.status == 400) {
            // "fix" broken json escaping in \'instances\' message
            body = body.replace("\\'instances\\'", "'instances'")
        }

        if (accept != undefined) {
            var content_types = accept.trim().replace(" ", "").split(",")
            if (content_types.includes('application/jsonlines') || content_types.includes('application/json')) {
                body = body.replace(/\n/g, '')
                r.headersOut['Content-Type'] = content_types[0]
            }
        }
        r.return(reply.status, body)
    }