Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterDY committed Jan 7, 2025
1 parent 74bc9f2 commit da08b03
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions thrift/annotation/http_mapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ func GetDescFromContent(content string, method string) (*thrift.FunctionDescript
return p.Functions()[method], nil
}

func GetDescFromContentWithOptions(content string, method string, opts thrift.Options) (*thrift.FunctionDescriptor, error) {
path := "a/b/main.thrift"
includes := map[string]string{
path: content,
}
p, err := opts.NewDescritorFromContent(context.Background(), path, content, includes, true)
if err != nil {
return nil, err
}
return p.Functions()[method], nil
}

func TestAPIQuery(t *testing.T) {
fn, err := GetDescFromContent(`
namespace go kitex.test.server
Expand Down Expand Up @@ -81,7 +93,7 @@ func TestAPIRawUri(t *testing.T) {
}

func TestAPIBody(t *testing.T) {
fn, err := GetDescFromContent(`
fn, err := GetDescFromContentWithOptions(`
namespace go kitex.test.server
struct Base {
1: required Base2 f1
Expand All @@ -95,7 +107,9 @@ func TestAPIBody(t *testing.T) {
service InboxService {
string ExampleMethod(1: Base req)
}
`, "ExampleMethod")
`, "ExampleMethod", thrift.Options{
ApiBodyFastPath: true,
})
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit da08b03

Please sign in to comment.