robospice icon indicating copy to clipboard operation
robospice copied to clipboard

response headers missing?

Open or-dvir opened this issue 9 years ago • 4 comments

Hi. i am using this library in conjunction with spring (using the class SpringAndroidSpiceRequest).

here is my load data from network:

@Override
	public T loadDataFromNetwork() throws Exception
	{
		HttpHeaders headers = new HttpHeaders();

		headers.add("Accept", "application/vnd.github.v3+json");

		headers.add("Authorization", User.getCurrentUserAuthenticationValue());

		if(mHttpMethod == HttpMethod.PUT)
		{
			headers.add("Content-Length", "0");
		}

		ResponseEntity<T> entity = getRestTemplate().exchange(mUrl, mHttpMethod, new HttpEntity<>(headers), mResponseType);

		mResponseHeaders = entity.getHeaders();

		return entity.getBody();
}

the problem is that for some reason mResponseHeaders is missing some headers, in particular one that is called "Link"

the header exists if i send the same request via web browser (using the DHC plugin):

4444444444444

am i doing something wrong? any ideas?

or-dvir avatar Nov 23 '16 08:11 or-dvir

I think the problem comes from Spring Android. This library is quite obsolete as of today and you should probably look for a more modern one with a better support.

2016-11-23 0:04 GMT-08:00 Or Dvir [email protected]:

Hi. i am using this library in conjunction with spring (using the class SpringAndroidSpiceRequest).

here is my load data from network:

@Override public T loadDataFromNetwork() throws Exception { HttpHeaders headers = new HttpHeaders();

  headers.add("Accept", "application/vnd.github.v3+json");

  headers.add("Authorization", User.getCurrentUserAuthenticationValue());

  if(mHttpMethod == HttpMethod.PUT)
  {
      headers.add("Content-Length", "0");
  }

  ResponseEntity<T> entity = getRestTemplate().exchange(mUrl, mHttpMethod, new HttpEntity<>(headers), mResponseType);

  mResponseHeaders = entity.getHeaders();

  return entity.getBody();

}

the problem is that for some reason mResponseHeaders is missing some headers, in particular one that is called "Link"

the header exists if i send the same request via web browser (using the DHC plugin):

[image: 4444444444444] https://cloud.githubusercontent.com/assets/17179542/20554379/2c11a524-b164-11e6-8c2d-b27b61d90610.JPG

am i doing something wrong? any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stephanenicolas/robospice/issues/464, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33Xu-e52TiZcFA2KFUuJgatFcAfHaks5rA_OggaJpZM4K6Tkj .

stephanenicolas avatar Nov 23 '16 15:11 stephanenicolas

@stephanenicolas any recommendations?

or-dvir avatar Nov 24 '16 07:11 or-dvir

OkHttp is definitely the reference on Android.

2016-11-23 23:04 GMT-08:00 Or Dvir [email protected]:

@stephanenicolas https://github.com/stephanenicolas any recommendations?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stephanenicolas/robospice/issues/464#issuecomment-262704717, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33aoXY-orpTMWcNqI3StO3RHq1Bxfks5rBTcDgaJpZM4K6Tkj .

stephanenicolas avatar Nov 24 '16 11:11 stephanenicolas

Retrofit is also very interesting. Explore the different extensions of RS. https://github.com/stephanenicolas/robospice/extensions

2016-11-24 3:01 GMT-08:00 Stéphane NICOLAS [email protected]:

OkHttp is definitely the reference on Android.

2016-11-23 23:04 GMT-08:00 Or Dvir [email protected]:

@stephanenicolas https://github.com/stephanenicolas any recommendations?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stephanenicolas/robospice/issues/464#issuecomment-262704717, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33aoXY-orpTMWcNqI3StO3RHq1Bxfks5rBTcDgaJpZM4K6Tkj .

stephanenicolas avatar Nov 24 '16 11:11 stephanenicolas