Skip to content

Commit

Permalink
GET method query param set from request
Browse files Browse the repository at this point in the history
  • Loading branch information
sudippalash authored Oct 8, 2023
1 parent 46b5a25 commit a7f8466
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Writing/PostmanCollectionWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,20 @@ protected function generateEndpointItem(OutputEndpointData $endpoint): array
'url' => $this->generateUrlObject($endpoint),
'method' => $method,
'header' => $this->resolveHeadersForEndpoint($endpoint),
'body' => $bodyParameters,
'description' => $endpoint->metadata->description,
],
'response' => $this->getResponses($endpoint),
];

// When method is GET and @queryParam block quote not found in function then query will be generate from request param.
if ($method == 'GET') {
if (empty($endpointItem['request']['url']['query']) && ! empty($bodyParameters) && ! empty($bodyParameters[$bodyParameters['mode']])) {
$endpointItem['request']['url']['query'] = $bodyParameters[$bodyParameters['mode']];
}
} else {
$endpointItem['request']['body'] = $bodyParameters;
}


if ($endpoint->metadata->authenticated === false) {
$endpointItem['request']['auth'] = ['type' => 'noauth'];
Expand Down

0 comments on commit a7f8466

Please sign in to comment.