-1

I send some values using spring httpClient to other url. And about that question as I know if I send name=mister age=30 values, received page get that values not http status values, right? Http status values are for sending page's not receive page's. I mean, if I send those values, receiving page gets http values. If receiving page want to get that values, I have send that values, is that right?

My team manager said to me that http has request and response so, if you send some values to other url, other url gets http status values. But as I thought that is little bit anyway I can't understand my team manager's saying, please let me know, receiving page gets http status when I send some values.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • Can you rephrase your question? Not fully understand what your question is. What is the original statement your team manager said? – shaochuancs Apr 18 '17 at 02:48
  • exactly that question is... we re making some document for our api, we're making some doc ,(document is about if customer want to receive some info, we will send that values), and we're sending web page. so, i wrote there the result about our send is name=mister and age =30 if succees and if fail name=null and age=null.....and my boss said to me "the http status have to be written."->i said "our page is sending page. so customer page don't get that http status value" -> my boss:"http has request and response. so there should have that http status value result" finally i dont know the truth – honey.E.seo Apr 18 '17 at 03:50
  • Fixed capitalization and punctuation (phrasing left untouched, not sure what he's asking) – Manfred Radlwimmer Apr 18 '17 at 09:04

1 Answers1

0

Your team manager's statement is correct. ("the http status have to be written.", "http has request and response. so there should have that http status value result"). What he/she mentioned is HTTP response status code, which should be returned (with correct code) whatever the response is.

No matter your result (name=mister and age =30 etc.) is a static page or an Ajax response, the response code should be 200 OK when the result is generated successfully (correct business logic, no error happens). But when something bad happens, it is important to let client know why server failed to return result -- maybe it is because the request format is incorrect (400 Bad Request), there is a typo in request url (404 Not Found) or some error in server code (500 Internal Server Error). Send name=null and age=null to client with 200 OK is incorrect and bug prone. Without definition of these error status code in document, backend engineer have to communicate with frontend engineer during the development, API by API, case by case, which is very time consuming and inefficient.

I think your TODO is: for the API that accepts name=mister and age =30, define success case and different failure case, then assign correct response code to them.

shaochuancs
  • 15,342
  • 3
  • 54
  • 62
  • http://stackoverflow.com/questions/43464321/how-to-get-http-status-value I make another question and the answer is ...request doesn't carry the http status code...can you see that question too??i just send some values without request. then where is my request??what is my request? i couldn't figure out...help me – honey.E.seo Apr 18 '17 at 07:15
  • Yes, status code belong to response, not request. In my answer, please note the linked text is "HTTP *response* status code". It's impossible to "send some values without request" -- a response without request does not exist. – shaochuancs Apr 18 '17 at 07:31
  • "Whenever you surf the web, your browser will be sending HTTP request messages for HTML pages, images, scripts and styles sheets. Web servers handle these requests by returning response messages that contain the requested resource." -- https://www.httpwatch.com/httpgallery/introduction/ – shaochuancs Apr 18 '17 at 07:33