anchor.diff:    window.localStorage["messages"] = JSON.encode(storedMessages);
   }
   
  -void processPOSTMessage(Map data) {
  +void processSamlPostBindingMessage(Map data) {
     Map body = data["requestBody"];
     if (body != null) {
       Map formData = body["formData"];
   
       if (formData != null) {
  -      List<String> responseList = formData["SAMLResponse"];
   
  -      if (responseList != null && responseList.length > 0) {
  -        String response = responseList[0];
  -        print("RESPONSE: $response");
  +      var parameter = null;
  +      if (postParameterExists(formData, "SAMLRequest")) {
  +        parameter = "SAMLRequest";
  +      } else if (postParameterExists(formData, "SAMLResponse")) {
  +        parameter = "SAMLResponse";
  +      } else {
  +        return; // Nothing for us to see here
  +      }
   
  -        var decoded = window.atob(response);
  -        print("DECODED RESPONSE: $decoded");
  +      var messages = formData[parameter];
   
  -        storeInLocalStorage(decoded, "SAMLResponse");
  -      }
  +      String message = messages[0];
  +      var decoded = window.atob(message);
  +      storeInLocalStorage(decoded, parameter);
       }
     }
   }
   
  -void processGETMessage(Map data) {
  +postParameterExists(Map formData, String parameter) {
  +  var messageList = formData[parameter];
  +  return messageList != null && messageList.length > 0;
  +}
  +
  +void processSamlRedirectBindingMessage(Map data) {
     var url = data["url"];
     Uri uri = Uri.parse(url);
  -  if (uri.hasQuery && uri.queryParameters.containsKey("SAMLRequest")) {
  -    var request = uri.queryParameters["SAMLRequest"];
  +
  +  if (uri.hasQuery) {
  +
  +    var queryKey = null;
  +    if (uri.queryParameters.containsKey("SAMLRequest")) {
  +      queryKey = "SAMLRequest";
  +    } else if (uri.queryParameters.containsKey("SAMLResponse")) {
  +      queryKey = "SAMLResponse";
  +    } else {
  +      return; // Nothing for us to see here
  +    }
  +
  +    var message = uri.queryParameters[queryKey];
       // The request is URL decoded already
   
  -    var base64Decoded = window.atob(request);
  +    var base64Decoded = window.atob(message);
   
       // TODO: We should find us a pub package instead of calling JS.
       JsObject pakoInflate = context["pako"];
       var inflatedBytes = pakoInflate.callMethod("inflateRaw", [base64Decoded]);
       var inflated = UTF8.decode(inflatedBytes);
   
  -    storeInLocalStorage(inflated, "SAMLRequest");
  +    storeInLocalStorage(inflated, queryKey);
     }
   }
positive.code: 
  onBeforeRequestHandler(Map data) {
    if (data["method"] == "GET") {
      processGETMessage(data);
    }
    else if (data["method"] == "POST") {
      processPOSTMessage(data);
    }
    else {
      // Ignore
    }
  }
  
  
negative.code: import '../chrome_extension_saml_decoder.dart';
  
  void main() {
    // Reset the current state of the localStorage each time the extension starts.
    window.localStorage["messages"] = JSON.encode([]);
  
    // Start listening for SAML messages.
    // We do this in JS, since the 'chrome' pub package has bugs and is not compatible with the actual
    // Chrome WebRequest API at the moment.https://github.com/dart-gde/chrome.dart/issues/213
    // Make sure to attach the event listener before the listener actually starts.
    context["navigationListenerCallback"] = (data) => onBeforeRequestHandler(data);
    JsFunction f = context["startListener"];
    f.apply(null);
  