File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/main/java/com/microsoft/graph/http Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2929import java .io .OutputStream ;
3030import java .net .HttpURLConnection ;
3131import java .net .ProtocolException ;
32+ import java .util .ArrayList ;
3233import java .util .HashMap ;
3334import java .util .List ;
3435import java .util .Map ;
@@ -110,7 +111,20 @@ public int getResponseCode() throws IOException {
110111 }
111112
112113 public Map <String , List <String >> getResponseHeaders () {
113- return connection .getHeaderFields ();
114+ // Copy unmodifiable map to hashmap
115+ HashMap <String , List <String >> headerFields = new HashMap <>();
116+ headerFields .putAll (connection .getHeaderFields ());
117+
118+ // Add the response code
119+ List <String > list = new ArrayList <>();
120+ try {
121+ list .add (String .format ("%d" , connection .getResponseCode ()));
122+ } catch (IOException e ) {
123+ throw new IllegalArgumentException ("Invalid connection response code: " , e );
124+ }
125+
126+ headerFields .put ("responseCode" , list );
127+ return headerFields ;
114128 }
115129
116130 @ Override
You can’t perform that action at this time.
0 commit comments