Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LabNbook
LabNbook-Moodle
Commits
2a327c6a
Commit
2a327c6a
authored
Feb 21, 2019
by
Francois Gannaz
Browse files
HTTP GET cannot pass a payload in its body
parent
c9ffd8fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
classes/session.php
View file @
2a327c6a
...
...
@@ -140,9 +140,12 @@ class mod_labnbook_session
protected
function
fetch
(
$verb
,
$urlPath
,
$defaultValue
=
null
,
$payload
=
[])
{
$payload
[
'key'
]
=
$this
->
secret
;
$curl
=
curl_init
();
if
(
$verb
===
'GET'
)
{
$urlPath
.
=
(
strpos
(
$urlPath
,
'?'
)
===
false
?
"?"
:
"&"
)
.
"key="
.
rawurlencode
(
$this
->
secret
);
}
curl_setopt_array
(
$curl
,
[
CURLOPT_RETURNTRANSFER
=>
true
,
CURLOPT_CUSTOMREQUEST
,
$verb
,
CURLOPT_CUSTOMREQUEST
=>
$verb
,
CURLOPT_URL
=>
$this
->
url
.
"/api/index.php"
.
$urlPath
,
CURLOPT_HTTPHEADER
,
[
'Content-Type:application/json'
,
'Accept:application/json'
],
CURLOPT_POSTFIELDS
=>
json_encode
(
$payload
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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