You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Talib (JIRA)" <ji...@apache.org> on 2010/07/16 20:31:50 UTC
[jira] Created: (COUCHDB-828) When Issuing a Get Request with
Content-Type: application/x-www-form-urlencoded an error is thrown
When Issuing a Get Request with Content-Type: application/x-www-form-urlencoded an error is thrown
--------------------------------------------------------------------------------------------------
Key: COUCHDB-828
URL: https://issues.apache.org/jira/browse/COUCHDB-828
Project: CouchDB
Issue Type: Bug
Affects Versions: 1.0
Reporter: Talib
When doing an AJAX GET Request, the content type is set to application/x-www-form-urlencoded, the request fails.
Removing the "Content-Type: application/x-www-form-urlencoded" header makes the request success.
Here is what the headers look like for a failed request.
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: application/json, text/javascript, */*
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-828) When Issuing a Get Request with
Content-Type: application/x-www-form-urlencoded an error is thrown
Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889263#action_12889263 ]
Chris Anderson commented on COUCHDB-828:
----------------------------------------
Can you provide more details as to which URL you were requesting?
Maybe sharing the JS code you are using to do this would help as well.
Thanks!
Chris
> When Issuing a Get Request with Content-Type: application/x-www-form-urlencoded an error is thrown
> --------------------------------------------------------------------------------------------------
>
> Key: COUCHDB-828
> URL: https://issues.apache.org/jira/browse/COUCHDB-828
> Project: CouchDB
> Issue Type: Bug
> Affects Versions: 1.0
> Reporter: Talib
>
> When doing an AJAX GET Request, the content type is set to application/x-www-form-urlencoded, the request fails.
> Removing the "Content-Type: application/x-www-form-urlencoded" header makes the request success.
> Here is what the headers look like for a failed request.
> Connection: keep-alive
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
> X-Requested-With: XMLHttpRequest
> Content-Type: application/x-www-form-urlencoded
> Accept: application/json, text/javascript, */*
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COUCHDB-828) When Issuing a Get Request with
Content-Type: application/x-www-form-urlencoded an error is thrown
Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-828?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul Joseph Davis updated COUCHDB-828:
--------------------------------------
Skill Level: Regular Contributors Level (Easy to Medium)
> When Issuing a Get Request with Content-Type: application/x-www-form-urlencoded an error is thrown
> --------------------------------------------------------------------------------------------------
>
> Key: COUCHDB-828
> URL: https://issues.apache.org/jira/browse/COUCHDB-828
> Project: CouchDB
> Issue Type: Bug
> Affects Versions: 1.0
> Reporter: Talib
>
> When doing an AJAX GET Request, the content type is set to application/x-www-form-urlencoded, the request fails.
> Removing the "Content-Type: application/x-www-form-urlencoded" header makes the request success.
> Here is what the headers look like for a failed request.
> Connection: keep-alive
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
> X-Requested-With: XMLHttpRequest
> Content-Type: application/x-www-form-urlencoded
> Accept: application/json, text/javascript, */*
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-828) When Issuing a Get Request with
Content-Type: application/x-www-form-urlencoded an error is thrown
Posted by "Talib (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12889270#action_12889270 ]
Talib commented on COUCHDB-828:
-------------------------------
I built a small test view, that returns a JSON object.
GET /autocomplete_test_v1/_design/feed/_list/json/bychar?limit=10&startkey=%5B%22A%22%2C%22B%22%5D&endkey=%5B%22A%22%2C%22B%22%2C%5B%5D%5D
The Code to use it was generated using jQuery. Look at the Comment in the code below for the relevant part.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link type="text/css" href="static/css/jqui/smoothness/jquery-ui-1.8.2.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="static/js/jquery-ui-1.8.2.custom.min.js"></script>
</head>
<body>
Test out the Autocomplete functionality
<form>
<input id="acInput" type="text"/>
</form>
<script type="text/javascript">
$(function() {
$("#acInput").autocomplete({
source: function(request, response) {
var start= [];
var input = request.term.toUpperCase();
for (var i = 0; i < input.length; ++i) {
start.push('"'+input.charAt(i)+'"');
}
var startParam = '['+start.join(",") + ']';
var endParam = '['+start.join(",") + ',[]]';
$.ajax({
url: "_list/jsonp/bychar",
// NOTICE THE LINE BELOW - If i comment this out, the Content-Type: application/x-www-form-urlencoded gets sent and couch db pukes on it.
contentType: "",
data: {
limit: 10
startkey : startParam,
endkey: endParam
},
success: function(data) {
response($.map(data, function(item) {
return {
value: item.value
}
}))
}
})
},
minLength: 1
});
});
</script>
</body>
</html>
> When Issuing a Get Request with Content-Type: application/x-www-form-urlencoded an error is thrown
> --------------------------------------------------------------------------------------------------
>
> Key: COUCHDB-828
> URL: https://issues.apache.org/jira/browse/COUCHDB-828
> Project: CouchDB
> Issue Type: Bug
> Affects Versions: 1.0
> Reporter: Talib
>
> When doing an AJAX GET Request, the content type is set to application/x-www-form-urlencoded, the request fails.
> Removing the "Content-Type: application/x-www-form-urlencoded" header makes the request success.
> Here is what the headers look like for a failed request.
> Connection: keep-alive
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4
> X-Requested-With: XMLHttpRequest
> Content-Type: application/x-www-form-urlencoded
> Accept: application/json, text/javascript, */*
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.