Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Roman Lacko
gitlab_api
Commits
dcbaf0e9
Commit
dcbaf0e9
authored
Jan 08, 2018
by
Roman Lacko
Browse files
allow arrayref and hashref parameters in API
parent
c89bbd79
Changes
1
Hide whitespace changes
Inline
Side-by-side
GitLab/API.pm
View file @
dcbaf0e9
...
...
@@ -203,7 +203,17 @@ sub create_uri {
# add query parameters
foreach
my
$param
(
@
{
$tmpl
->
{
query
}
//
[]
})
{
if
(
exists
$args
->
{
$param
})
{
$uri
->
query_param
(
$param
=>
$args
->
{
$param
});
if
(
ref
$args
->
{
$param
}
eq
"
ARRAY
")
{
foreach
my
$val
(
@
{
$args
->
{
$param
}
})
{
$uri
->
query_param_append
(
$param
,
$val
);
}
}
elsif
(
ref
$args
->
{
$param
}
eq
"
HASH
")
{
while
(
my
(
$key
,
$val
)
=
each
%
{
$args
->
{
$param
}})
{
$uri
->
query_param_append
("
$param
\
[
$key
\
]
",
$val
);
}
}
else
{
$uri
->
query_param_append
(
$param
=>
$args
->
{
$param
});
}
delete
$args
->
{
$param
};
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment