bad-request

Google API token endpoint POST returns Bad Request 400

非 Y 不嫁゛ 提交于 2019-12-08 19:39:32
问题 I am trying to exchange a one-time Google Plus Authorization code for an access token. But I keep on getting a 400 Bad Request. I am using VB.NET. Here is the code: 'We should now have a "good" one-time authorization code stored in "code" Using Client As New WebClient() 'Dim Client As New WebClient() Dim values As New NameValueCollection() Dim Resp Dim responseString As String values("code") = Request.QueryString("code") values("client_id") = ConfigurationManager.AppSettings("google.clientid"

Can't get error message on BadRequest in Web Api 2

牧云@^-^@ 提交于 2019-12-08 19:22:51
问题 I've googled a lot searching for an answer to my problem with no luck so, let's try if someone else can help me. I have a Web Api 2 action to register an user after doing some validations. If everything works, it return the serialized user and if don't, an error message sent within a BadRequest response. At the other hand, I have a WPF client that calls the API for a response. My problem is that I can't get the reason sent by the error, the client just get the Bad Request error message. This

Spring Boot File Upload Bad Request 400

妖精的绣舞 提交于 2019-12-08 08:39:34
问题 Hello im writing an Webapplication using Spring Boot and AngularJs and need an simple file upload which is not working at the moment. I already read that spring boot should autoconfigure the multipart upload itself when the mvc dependency is present. From :https://spring.io/guides/gs/uploading-files/ As part of auto-configuring Spring MVC, Spring Boot will create a MultipartConfigElement bean and make itself ready for file uploads. Javascript Function which sends the Request: var postFormData

Java/Spring > Handle Bad Request response for controller method with @RequestBody when no body is sent in request

落爺英雄遲暮 提交于 2019-12-08 07:02:47
问题 long story short: I'm creating API that is supposed to be 100% REST. I'm trying to overwrite default response for the following case: I've got a method in my @RestController that has @RequestBody as an attribute @RequestMapping(value = {"register"}, method = RequestMethod.POST, produces = "application/hal+json") public Resource<User> registerClient(@RequestBody User user, HttpServletRequest request) and the method is working just fine if I send a proper request. But there is a problem when I

Web Api 2 bad request

不打扰是莪最后的温柔 提交于 2019-12-08 04:32:01
问题 Im a beginner with Web api and Im trying to setup a simple owin selfhosted service that Im trying out. I've been searching stackoverflow and other places for a while now, but I cant seem to find anything obviously wrong. The problem I have is that I get a bad request response everytime I try to call my service. The controller looks like this: [RoutePrefix("api/ndtdocument")] public class NDTDocumentsController : ApiController, INDTDocumentsController { [HttpGet] public IHttpActionResult Get()

Spring Boot File Upload Bad Request 400

时间秒杀一切 提交于 2019-12-07 17:02:31
Hello im writing an Webapplication using Spring Boot and AngularJs and need an simple file upload which is not working at the moment. I already read that spring boot should autoconfigure the multipart upload itself when the mvc dependency is present. From : https://spring.io/guides/gs/uploading-files/ As part of auto-configuring Spring MVC, Spring Boot will create a MultipartConfigElement bean and make itself ready for file uploads. Javascript Function which sends the Request: var postFormData = function (file, url, successCallback, errorCallback, progressCallback) { var xhr = new

Java/Spring > Handle Bad Request response for controller method with @RequestBody when no body is sent in request

妖精的绣舞 提交于 2019-12-07 07:54:26
long story short: I'm creating API that is supposed to be 100% REST. I'm trying to overwrite default response for the following case: I've got a method in my @RestController that has @RequestBody as an attribute @RequestMapping(value = {"register"}, method = RequestMethod.POST, produces = "application/hal+json") public Resource<User> registerClient(@RequestBody User user, HttpServletRequest request) and the method is working just fine if I send a proper request. But there is a problem when I don't. When a request has empty body, I get a generic Tomcat error page for status 400 and I need it to

Can Tomcat accept HTTP 1.1 requests without a Host header?

江枫思渺然 提交于 2019-12-07 03:44:33
问题 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

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

ε祈祈猫儿з 提交于 2019-12-07 01:56: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 {%

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

不羁岁月 提交于 2019-12-06 16:19:28
问题 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.