Merge remote-tracking branch 'origin' into 7.0.x

This commit is contained in:
William Cheng
2023-03-03 21:52:50 +08:00
10595 changed files with 418520 additions and 73194 deletions

View File

@@ -480,6 +480,15 @@ Class | Method | HTTP request | Description
# DOCUMENTATION FOR AUTHORIZATION
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets
## api_key
- **Type**: API key
@@ -492,11 +501,11 @@ Class | Method | HTTP request | Description
- **API key parameter name**: api_key_query
- **Location**: URL query string
## bearer_test
## http_basic_test
- **Type**: HTTP basic authentication
## http_basic_test
## bearer_test
- **Type**: HTTP basic authentication
@@ -504,12 +513,3 @@ Class | Method | HTTP request | Description
- **Type**: HTTP basic authentication
## petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **write:pets**: modify pets in your account
- **read:pets**: read your pets

View File

@@ -112,7 +112,7 @@ This endpoint does not need any parameter.
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
### Example
```perl

View File

@@ -341,6 +341,11 @@ sub update_params_for_auth {
if (!defined($auth)) {
# TODO show warning about auth setting not defined
}
elsif ($auth eq 'petstore_auth') {
if ($self->{config}{access_token}) {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
elsif ($auth eq 'api_key') {
my $api_key = $self->get_api_key_with_prefix('api_key');
if ($api_key) {
@@ -353,24 +358,19 @@ sub update_params_for_auth {
$query_params->{'api_key_query'} = $api_key;
}
}
elsif ($auth eq 'http_basic_test') {
if ($self->{config}{username} || $self->{config}{password}) {
$header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password});
}
}
elsif ($auth eq 'bearer_test') {
# this endpoint requires Bearer (JWT) authentication (access token)
if ($self->{config}{access_token}) {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
elsif ($auth eq 'http_basic_test') {
if ($self->{config}{username} || $self->{config}{password}) {
$header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password});
}
}
elsif ($auth eq 'http_signature_test') {
}
elsif ($auth eq 'petstore_auth') {
if ($self->{config}{access_token}) {
$header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token};
}
}
else {
# TODO show warning about security definition not found
}

View File

@@ -66,7 +66,7 @@ is $get_pet_hash->{photoUrls}->[1], 'oop', 'get the proper photoUrl from get_pet
my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
is $update_pet_with_form, undef, 'get the null response from update_pet_with_form';
my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id);
is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form';

View File

@@ -135,7 +135,7 @@ my $cleared_tokens_cmp = {
};
cmp_deeply( $api->_cfg->clear_tokens, $cleared_tokens_cmp, 'clear_tokens() returns the correct data structure' );
my $bad_token = { bad_token_name => 'bad token value' }; # value should should be hashref
my $bad_token = { bad_token_name => 'bad token value' }; # value should be hashref
dies_ok { $api->_cfg->accept_tokens($bad_token) } "bad token causes exception";

View File

@@ -77,7 +77,7 @@ is $get_pet_hash->{photoUrls}->[1], 'oop', 'get the proper photoUrl from get_pet
my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
is $update_pet_with_form, undef, 'get the null response from update_pet_with_form';
my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id);
is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form';

View File

@@ -45,7 +45,7 @@ isa_ok($human, 'WWW::OpenAPIClient::Object::Human');
#
#
#my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
#is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
#is $update_pet_with_form, undef, 'get the null response from update_pet_with_form';
#
#my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id);
#is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form';