added if statement to prefent nullpointer exception when only a http header is sent.