bad-request

Restful WCF POST issue with application/json content type request

橙三吉。 提交于 2019-12-06 12:28:55
问题 I've configured a RESTful WCF with the following POST "operation": [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/Test", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json)] void PostTest(Stream stream); In my web.config, I've configured the following: <service name="MyTest.TestSvc" behaviorConfiguration="MyTest.TestBehavior" > <endpoint address="" behaviorConfiguration="MyBehavior" binding="webHttpBinding" contract="MyTest.ITestSvc"/> <endpoint

Firefox “Bad request” caused by corrupt google tracking cookie

落爺英雄遲暮 提交于 2019-12-06 10:22:46
We have an issue on our site whereby some Firefox users are receiving a "Bad Request" message when they visit our site (nothing else, just the words "Bad Request"!) This would appear to be due to a corrupt google tracking cookie, possibly __utmz (one person delete the google cookies in turn and once that one was removed the site came back to life.) Our website uses this Javascript google tracking code: var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text

Telegram Bot API: getChatMember throws USER_ID_INVALID for valid user

£可爱£侵袭症+ 提交于 2019-12-06 03:01:18
问题 I'm trying to find out if a specific User is present in a supergroup, in order to keep track of those who left. For that, I'm calling the Bot API method getChatMember for each User and checking if their status is either Left or Kicked . However, I noticed that (recently?) I'm getting USER_ID_INVALID errors for many valid users that are either in the supergroup or have been in the past and then left. I also confirmed that those accounts are still active on Telegram. Here's the HTTP request I'm

Tomcat is not redirecting to 400 bad request custom error page

六月ゝ 毕业季﹏ 提交于 2019-12-05 17:25:17
We have tomcat 9 web server in production. The problem we are facing is we want to show the custom error page for our application if tomcat receives any malformed URL as follows http://URL/| or http://URL/[ I have added error page tag in web.xml of tomcat application server as follows <error-page> <error-code>400</error-code> <location>/error.html</location> </error-page> <error-page> <error-code>404</error-code> <location>/error.html</location> </error-page> and we have error.html in our application ROOT folder in webapps directory of tomcat. Whenever the user tries to request any nonexistent

Can Tomcat accept HTTP 1.1 requests without a Host header?

青春壹個敷衍的年華 提交于 2019-12-05 07:19:14
HTTP 1.1 states: "A client MUST include a Host header field in all HTTP/1.1 request messages" However, the machines I am working on send out this exact POST (containing coordinates), which I do not have access to change: POST /touch HTTP/1.1 Content-type: application/x-www-form-urlencoded Content-Length: <n> x=<int x>&y=<int y> Tomcat 7 immediately responds with 400 Bad Request due to the lack of a Host header field, and the POST never gets to my servlet. Is there any way I can avoid this error response and handle the POST with the servlet to support these older machines? As you already noted,

Django | joined path is located outside of the base path component {% static img.thumbnail.url %}, Error 400 with whitenoise

我与影子孤独终老i 提交于 2019-12-05 06:07:55
I've finish my first app in Django and works perfectly, but still have pre-deployment problems since I set DEGUG=False ... Here is just to display an image in a template... T_T I was using this, but now it does'nt work when I use whitenoise to serve my image localy... And it return a Bad Request(400) error... Models.py class GalleryItem(models.Model): thumbnail = models.ImageField(blank=True,upload_to='gallery/thumb') img_wide = models.ImageField(blank=True,upload_to='gallery') template.py {% load staticfiles %} {% for img in img_to_display %} <a href="{{ img.img_wide.url}}" class="swipebox"

Django and Bad Request (400)

谁说胖子不能爱 提交于 2019-12-05 04:30:00
问题 I created new django project; added to my settings.py: DEBUG = False ALLOWED_HOSTS= [ 'localhost', 'my_site.com' ] created app test_view ; added hello_world to test_view.views from django.http.response import HttpResponse def hello_world(request): return HttpResponse('Hello World!!!') added test route to urls.py url(r'test/', 'test_view.views.hello_world') ; fixed /etc/hosts 127.0.0.1 localhost my_site.com Now when i'm trying to access http://my_site.com:8000/test/ django returns Bad Request

MVC Controller return a bad request?

别说谁变了你拦得住时间么 提交于 2019-12-04 22:13:45
I was wondering if it was possible to return a bad request with content from an MVC Controller? The only way I have been able to do this is to throw HttpException however here I can't set any content. Tried this approach to but for some odd reason I am always getting an OK back. Is it possible to do this? public class SomeController : Controller { [HttpPost] public async Task<HttpResponseMessage> Foo() { var response = new HttpResponseMessage(HttpStatusCode.BadRequest); response.Content = new StringContent("Naughty"); return response; } } return new HttpStatusCodeResult(HttpStatusCode

how to get Google plus access token in windows application C#.net

丶灬走出姿态 提交于 2019-12-04 22:07:31
I am preparing a windows application in that I want to use oAuth2 to access info from google plus. But I am getting bad request for my following code.. I am able to create app in google console and fetch the "code" for application access. WebRequest request = WebRequest.Create( GoogleAuthenticationServer.Description.TokenEndpoint ); // You must use POST for the code exchange. request.Method = "POST"; // Create POST data. string postData = FormPostData(code); byte[] byteArray = Encoding.UTF8.`enter code here`GetBytes(postData); // Set up the POST request for the code exchange. request

Restful WCF POST issue with application/json content type request

坚强是说给别人听的谎言 提交于 2019-12-04 18:19:50
I've configured a RESTful WCF with the following POST "operation": [OperationContract] [WebInvoke(Method = "POST", UriTemplate = "/Test", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json)] void PostTest(Stream stream); In my web.config, I've configured the following: <service name="MyTest.TestSvc" behaviorConfiguration="MyTest.TestBehavior" > <endpoint address="" behaviorConfiguration="MyBehavior" binding="webHttpBinding" contract="MyTest.ITestSvc"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <endpointBehaviors>