I want to abort a download, if a condition inside of onReceiveHeader is true. The following code do the job, but it feels very wrong - is there a better/proper way to do such a thing?

client.onReceiveHeader = (in char[] key, in char[] value) {
  if(key == "content-type") {
    if( -1 == value.indexOf("text" ,0, No.caseSensitive) ) {
      throw new ContentTypeException("No Text");
    }
  }
};


Reply via email to