2018-02-01 22:30:17 +00:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2019-04-12 21:54:35 +00:00
|
|
|
"github.com/hashicorp/vault/sdk/framework"
|
2019-04-13 07:44:06 +00:00
|
|
|
"github.com/hashicorp/vault/sdk/logical"
|
2018-02-01 22:30:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// pathRaw is used to test raw responses.
|
|
|
|
func pathRaw(b *backend) *framework.Path {
|
|
|
|
return &framework.Path{
|
|
|
|
Pattern: "raw",
|
|
|
|
Callbacks: map[logical.Operation]framework.OperationFunc{
|
|
|
|
logical.ReadOperation: b.pathRawRead,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (b *backend) pathRawRead(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
|
|
|
|
return &logical.Response{
|
|
|
|
Data: map[string]interface{}{
|
|
|
|
logical.HTTPContentType: "text/plain",
|
|
|
|
logical.HTTPRawBody: []byte("Response"),
|
|
|
|
logical.HTTPStatusCode: 200,
|
|
|
|
},
|
|
|
|
}, nil
|
|
|
|
}
|