@@ -17,8 +17,11 @@ func TestAnnotateContext(t *testing.T) {
1717 if err != nil {
1818 t .Fatalf ("http.NewRequest(%q, %q, nil) failed with %v; want success" , "GET" , "http://localhost" , err )
1919 }
20+
21+ request .RemoteAddr = "127.0.0.1"
2022 request .Header .Add ("Some-Irrelevant-Header" , "some value" )
2123 annotated := runtime .AnnotateContext (ctx , request )
24+ ctx = metadata .NewContext (ctx , metadata .Pairs ("RemoteAddr" , "127.0.0.1" ))
2225 if annotated != ctx {
2326 t .Errorf ("AnnotateContext(ctx, request) = %v; want %v" , annotated , ctx )
2427 }
@@ -29,8 +32,8 @@ func TestAnnotateContext(t *testing.T) {
2932 request .Header .Add ("Authorization" , "Token 1234567890" )
3033 annotated = runtime .AnnotateContext (ctx , request )
3134 md , ok := metadata .FromContext (annotated )
32- if ! ok || len (md ) != 3 {
33- t .Errorf ("Expected 3 metadata items in context; got %v" , md )
35+ if ! ok || len (md ) != 4 {
36+ t .Errorf ("Expected 4 metadata items in context; got %v" , md )
3437 }
3538 if got , want := md ["foobar" ], []string {"Value1" }; ! reflect .DeepEqual (got , want ) {
3639 t .Errorf (`md["foobar"] = %q; want %q` , got , want )
0 commit comments