renderClientDecodeCode renders the client decode section for a single-service DSL and returns the generated code.
(t *testing.T, dsl func())
| 93 | // renderClientDecodeCode renders the client decode section for a single-service |
| 94 | // DSL and returns the generated code. |
| 95 | func renderClientDecodeCode(t *testing.T, dsl func()) string { |
| 96 | t.Helper() |
| 97 | |
| 98 | root := RunHTTPDSL(t, dsl) |
| 99 | services := CreateHTTPServices(root) |
| 100 | fs := ClientFiles("", services) |
| 101 | require.Len(t, fs, 2) |
| 102 | |
| 103 | sections := fs[1].SectionTemplates |
| 104 | require.Greater(t, len(sections), 2) |
| 105 | |
| 106 | return codegen.SectionCode(t, sections[2]) |
| 107 | } |
| 108 | |
| 109 | // oneOfResultSingleViewDSL defines a ResultType whose only view drops the OneOf |
| 110 | // field. Client response code must therefore treat the transport body as the |
no test coverage detected