Skip to content

Commit

Permalink
fix: Unwrap body parameters (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennycode committed Jun 18, 2019
1 parent 6e58d22 commit 2e2b2cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/templates/Resource.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ export class {{{name}}} {
{{/if}}
}
{{else}}
{{#if this.bodyParameters.length}}
{{#eq this.bodyParameters.length 1}}
const data = {{{this.bodyParameters.[0].name}}};
{{/eq}}
{{#gt this.bodyParameters.length}}
const data = {
{{#each this.bodyParameters}}{{this.name}},{{/each}}
{{#each this.bodyParameters}}{{{this.name}}},{{/each}}
};
{{/if}}
{{/gt}}
{{#if this.queryParameters.length}}
const config = {params};
{{/if}}
Expand Down
4 changes: 1 addition & 3 deletions src/test/snapshots/1-query-param-description.ts.fixture
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export class ArchiveService {
body: {archive: {}; conversationId: string}
): Promise<{instanceId: string; name: string}> {
const resource = `/instance/${instanceId}/archive`;
const data = {
body,
};
const data = body;
const response = await this.apiClient.post<{
instanceId: string;
name: string;
Expand Down

0 comments on commit 2e2b2cb

Please sign in to comment.