open-vault/sdk/plugin/mock/path_raw.go
Hamid Ghaf 27bb03bbc0
adding copyright header (#19555)
* adding copyright header

* fix fmt and a test
2023-03-15 09:00:52 -07:00

32 lines
760 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package mock
import (
"context"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/logical"
)
// 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
}