- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
The response header of a JSON-RPC response is 'text/javascript'. Why?
- wuarmin
- Topic Author
- Offline
- New Member
Less
More
5 months 3 weeks ago #251660
by wuarmin
The response header of a JSON-RPC response is 'text/javascript'. Why? was created by wuarmin
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.2.11
Own server or LimeSurvey hosting: yes
Survey theme/template:
==================
Hey,
I want to know, why the response header of a RemoteControl-JSON-RPC-request is 'text/javascript' instead of 'application/json'?
It seems the header is set here: github.com/LimeSurvey/LimeSurvey/blob/9d...sonRPCServer.php#L81
Thanks
Your LimeSurvey version: LimeSurvey Community Edition Version 6.2.11
Own server or LimeSurvey hosting: yes
Survey theme/template:
==================
Hey,
I want to know, why the response header of a RemoteControl-JSON-RPC-request is 'text/javascript' instead of 'application/json'?
It seems the header is set here: github.com/LimeSurvey/LimeSurvey/blob/9d...sonRPCServer.php#L81
Thanks
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
5 months 3 weeks ago #251672
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
I'll move this into "Development" where I think it fits better.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- wuarmin
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 months 3 weeks ago #251674
by wuarmin
Replied by wuarmin on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
Ok, thank you. Do you know the reason?
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
5 months 3 weeks ago #251677
by holch
If I would know the reason, I would have told you.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
Do you know the reason?
If I would know the reason, I would have told you.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- mfavetti
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 12
5 months 3 weeks ago #251706
by mfavetti
Replied by mfavetti on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
Looked into this a bit.
The original json rpc library limesurvey added and extended used text/javascript as the content type for the response. The original website for the code is gone, but I found a few forks. Most of them have changed this to application/json. Doing some googling, I reached the conclusion that application/json should be the content type used for json.
So I guess the reason is just that's what the original author of the library did and no one ever changed it.
The original json rpc library limesurvey added and extended used text/javascript as the content type for the response. The original website for the code is gone, but I found a few forks. Most of them have changed this to application/json. Doing some googling, I reached the conclusion that application/json should be the content type used for json.
So I guess the reason is just that's what the original author of the library did and no one ever changed it.
Please Log in to join the conversation.
- mfavetti
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 12
5 months 3 weeks ago #251708
by mfavetti
Replied by mfavetti on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
5 months 3 weeks ago #251716
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
There are no rules on spec :
www.jsonrpc.org/specification_v1
.
But seems more logical.
Can you send a PR for the update fork ? I like to read the explanation.
But seems more logical.
Can you send a PR for the update fork ? I like to read the explanation.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Please Log in to join the conversation.
- mfavetti
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 12
5 months 3 weeks ago - 5 months 3 weeks ago #251719
by mfavetti
Replied by mfavetti on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
developer.mozilla.org/en-US/docs/Web/HTT...E_types/Common_types
search for json, yields application/json
here's a fork that's made the change (forked from same codebase LS uses):
github.com/tomgross/jsonrpcphp/blob/mast...sonRPCServer.php#L77
search for json, yields application/json
here's a fork that's made the change (forked from same codebase LS uses):
github.com/tomgross/jsonrpcphp/blob/mast...sonRPCServer.php#L77
Last edit: 5 months 3 weeks ago by mfavetti.
The following user(s) said Thank You: DenisChenu, wuarmin
Please Log in to join the conversation.
- wuarmin
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
5 months 3 weeks ago - 5 months 3 weeks ago #251723
by wuarmin
Replied by wuarmin on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
Hey,
It's described in this specification:
www.jsonrpc.org/historical/json-rpc-over-http.html
It's described in this specification:
www.jsonrpc.org/historical/json-rpc-over-http.html
Content-Type SHOULD be 'application/json-rpc' but MAY be 'application/json' or 'application/jsonrequest'
Last edit: 5 months 3 weeks ago by wuarmin.
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
5 months 3 weeks ago #251725
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
It's NOT is V1 spec 2008 > 2005.
But i already answer seems better
But i already answer seems better
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: wuarmin
Please Log in to join the conversation.
- r0bis
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 7
5 months 5 days ago - 5 months 5 days ago #252444
by r0bis
r0berts
Replied by r0bis on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
It seems that this would need better explanation, perhaps in LS documentation. Rationale: The only people who use RPC are those who use it programmatically (Python, R etc. access). They are used to getting the existing kind of response. Thus implication is - existing code / workflow may break (it has
bugs.limesurvey.org/view.php?id=19258
)
Therefore testing and some explanation how to migrate the code would be quite important. People who use RPC probably use it for the magic of automation of something that ordinary users don't know about but like to be able to use. If the magic breaks people cannot use the automation and turn to the person who introduced using RPC. Automation is usually needed to process a lot of data, hence breakage can affect a lot.
Would people please look into this aspect of testing and documentation?
Therefore testing and some explanation how to migrate the code would be quite important. People who use RPC probably use it for the magic of automation of something that ordinary users don't know about but like to be able to use. If the magic breaks people cannot use the automation and turn to the person who introduced using RPC. Automation is usually needed to process a lot of data, hence breakage can affect a lot.
Would people please look into this aspect of testing and documentation?
r0berts
Last edit: 5 months 5 days ago by r0bis.
Please Log in to join the conversation.
- r0bis
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 7
5 months 5 days ago #252456
by r0bis
r0berts
Replied by r0bis on topic The response header of a JSON-RPC response is 'text/javascript'. Why?
OK, thanks everyone, this was quickly resolved by @mfavetti and @JanE:
@mfavetti made a PR for limer that fixes the issue.
Using that PR I created a new fork of limer with that PR
You can test it by running
CODE:
devtools::install_github("Jan-E/limer", force = TRUE)
See github.com/cloudyr/limer/pull/66 and github.com/Jan-E/limer
It should soon make it to the main release.
@mfavetti made a PR for limer that fixes the issue.
Using that PR I created a new fork of limer with that PR
You can test it by running
CODE:
devtools::install_github("Jan-E/limer", force = TRUE)
See github.com/cloudyr/limer/pull/66 and github.com/Jan-E/limer
It should soon make it to the main release.
r0berts
Please Log in to join the conversation.