Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
4.4.16
-
None
-
None
-
Important
Description
Dear Apache HttpClient team,
I would like to report a bug in the documentation for Apache HttpClient. Specifically, I have found an error in the section on 1.1.3. Working with message headers.(link: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fundamentals.html )
HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK"); response.addHeader("Set-Cookie", "c1=a; path=/; domain=localhost"); response.addHeader("Set-Cookie", "c2=b; path=\"/\", c3=c; domain=\"localhost\"");HeaderElementIterator it = new BasicHeaderElementIterator( response.headerIterator("Set-Cookie"));while (it.hasNext()) { HeaderElement elem = it.nextElement(); System.out.println(elem.getName() + " = " + elem.getValue()); NameValuePair[] params = elem.getParameters(); for (int i = 0; i < params.length; i++) { System.out.println(" " + params[i]); } }
HttpClient 4.5 Tutorial output result written in the document is:
c1 = a path=/ domain=localhost c2 = b path=/ c3 = c domain=localhost
This is incorrect, the correct output should be:
c1 = a path=/ domain=localhost c2 = b path=/ c3 = c domain=localhost
Could you please fix the format display? This may cause trouble for developers.
Here are the pictures:
Thank you for your attention to this matter.
Sincerely