Skip to content

How to read body in handler? (using params cause fields to be re-ordered) #2665

@khanzadimahdi

Description

@khanzadimahdi

Problem statement

I have an endpoint in my API which will be called using a webhook.
webhook signs the request and then my API must verify at first. but go-swagger converts the body to object and it can cause
request json fields re-ordered
, so the verification of sign will be failed because the received request is not equal to actual one.

how can I read the raw body of request in my handler? I have tried to access params.HTTPRequest.Body , however it says body is closed and panics.

Environment

swagger version: v0.27.0
go version: 1.17.01
OS: ubuntu20.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions