get

POST request treated as GET in Heroku environment

别等时光非礼了梦想. 提交于 2019-12-01 17:39:27
I have weird case. I have a RoR app, which provides REST API which I'm connecting to from Java application. I'm developing RoR locally, and deploying it on Heroku environment. Regardless how (I tried from Java APP, Mozilla REST client, etc.) I try to send POST HTTP request that should be handled by create action in api controller. On localhost - everything is working as expected. On Heroku production env - the POST request is treated as normal GET. Here are my routes for this resource: api_v1_items GET /api/v1/items(.:format) api/v1/items#index {:format=>:json} POST /api/v1/items(.:format) api

How to bind a request model in WebAPI GET request with route attribute?

雨燕双飞 提交于 2019-12-01 17:19:41
问题 GET :http://www.Example.com/Api/1/0/Book/Company/0 [Route("{UserId}/{Category}/books/{BookType}/{Page}")] [HttpGet] [RequestAuthorization] public Response Get(int UserId,string Category, string BookType,int Page ) { var books= this.contentService.GetUserItems(UserId,Category, BookType, Page) return new Response() { Status = ApiStatusCode.Ok, Books = books}; } The above code works well for me. My question is is it possible to bind a request model in GET request ? for example I have a request

AJAX and NS_ERROR_DOM_BAD_URI error

安稳与你 提交于 2019-12-01 17:16:16
I have been having the following problem, i think it's probably due to the fact that my approach may be misguided, but hopefully with your help i can sort this out! Basically, for my site i have a search provider (who has been paid, so i am not breaking any terms of use). When the search form is subbmitted i am directed to their domain where the results are displayed. Whilst i can customise the look of the returned results, there is only so far i can take this, and will never get it fitting in fully with the look and feel of my site. So, i thought, instead of doing the regular GET via the form

POST request treated as GET in Heroku environment

我的梦境 提交于 2019-12-01 16:51:11
问题 I have weird case. I have a RoR app, which provides REST API which I'm connecting to from Java application. I'm developing RoR locally, and deploying it on Heroku environment. Regardless how (I tried from Java APP, Mozilla REST client, etc.) I try to send POST HTTP request that should be handled by create action in api controller. On localhost - everything is working as expected. On Heroku production env - the POST request is treated as normal GET. Here are my routes for this resource: api_v1

Android Cannot access org.apache.http.client.HttpClient

≯℡__Kan透↙ 提交于 2019-12-01 16:49:06
I'm using android studio to create an app that makes a GET request to a server. My code is this: import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGetHC4; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; public class HTTPHelper { private String base; public HTTPHelper (String base) { this.base = base; } public String doGet (String path) { try { CloseableHttpClient client = HttpClientBuilder.create().build(); HttpGetHC4 get = new HttpGetHC4(path); CloseableHttpResponse response =

What's wrong with putting spaces in $_GET variables

。_饼干妹妹 提交于 2019-12-01 16:16:57
问题 If I for example have my url looking like index.php?category=IT%20&%20Soft. Then i try to print "$_GET[category]" i only get "IT" and not "IT & Soft". What is wrong here? It's frustrating me. 回答1: The problem is not the spaces, but the ampersand. Use %26 instead, like this: index.php?category=IT%20%26%20Soft The ampersand indicates that you are beginning another field (like category=IT&subcategory=somethingelse ). You can see a list of reserved characters on Wikipedia. 回答2: Spaces and

HttpClient4.x:Get和Post提交数据

做~自己de王妃 提交于 2019-12-01 16:11:27
HttpClient是一款用Java写的非常好用的基于Http协议的客户端编程工具包。具体举例来讲,用它可以模拟form表单提交数据动作,可以模拟访问网页动作及得到网页源码内容等等,这两点或许是我们在工作中最常用到的。 这里也主要是以介绍模拟form表单提交数据来介绍一下HttpClient,准确地讲主要是4.x版本,因为我发现在日常中,HttpClient的使用都还是使用3.x的版本,而现在HttpClient的官网上,都已经是最新版本4.1.3了,3.x版本在官网不见丝毫踪影,进入到下载页面也见不着3.x版本的下载。 HttpClient对于使用者而言,一个非常大的好处就是它的例子非常丰富,几乎每个功能都有对应的例子代码,这里讲的模拟form表单提交数据也是来源于HttpClient自带的例子。 一、Get提交方式 DefaultHttpClient httpclient = new DefaultHttpClient(); try { //注:如果参数值为中文的话,提交过去后可能会是乱码 HttpGet httpget = new HttpGet("http://www.xxx.com/x.jsp?username=zhangsan&age=20"); HttpResponse response = httpclient.execute(httpget);

Why is using a HTTP GET to update state on the server in a RESTful call incorrect?

穿精又带淫゛_ 提交于 2019-12-01 15:57:10
OK, I know already all the reasons on paper why I should not use a HTTP GET when making a RESTful call to update the state of something on the server. Thus returning possibly different data each time. And I know this is wrong for the following 'on paper' reasons: HTTP GET calls should be idempotent N > 0 calls should always GET the same data back Violates HTTP spec HTTP GET call is typically read-only And I am sure there are more reasons. But I need a concrete simple example for justification other than "Well, that violates the HTTP Spec!". ...or at least I am hoping for one. I have also

Android Cannot access org.apache.http.client.HttpClient

耗尽温柔 提交于 2019-12-01 15:47:20
问题 I'm using android studio to create an app that makes a GET request to a server. My code is this: import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGetHC4; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; public class HTTPHelper { private String base; public HTTPHelper (String base) { this.base = base; } public String doGet (String path) { try { CloseableHttpClient client =

Fetch only headers of a GET request in Node

∥☆過路亽.° 提交于 2019-12-01 13:19:35
问题 I need to get the Content-Length and Content-Type headers of large files with Node. Unfortunately, the server I'm dealing with doesn't allow HEAD requests, and the files are too large to make an entire GET request. I'm looking for something like this python code: import requests r = requests.get(url, stream=True) content_length = r.headers['Content-Length'] content_type = r.headers['Content-Type'] The stream=True parameter means that the file won't be fully downloaded. 回答1: If you're using