Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET method query param set from request #742

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading