"use strict";

import { IRequestParser } from '../models/IRequestParser';
import { CurlRequestParser } from '../utils/curlRequestParser';
import { HttpRequestParser } from '../utils/httpRequestParser';

export interface IRequestParserFactory {
    createRequestParser(rawHttpRequest: string);
}

export class RequestParserFactory implements IRequestParserFactory {

    private static readonly curlRegex: RegExp = /^\s*curl/i;

    public createRequestParser(rawHttpRequest: string): IRequestParser {
        if (RequestParserFactory.curlRegex.test(rawHttpRequest)) {
            return new CurlRequestParser();
        } else {
            return new HttpRequestParser();
        }
    }
}
"use strict";

import { IRequestParser } from '../models/IRequestParser';
import { CurlRequestParser } from '../utils/curlRequestParser';
import { HttpRequestParser } from '../utils/httpRequestParser';

export interface IRequestParserFactory {
    createRequestParser(rawHttpRequest: string);
}

export class RequestParserFactory implements IRequestParserFactory {
    public createRequestParser(rawHttpRequest: string): IRequestParser {
        if (rawHttpRequest.trim().toLowerCase().startsWith('curl'.toLowerCase())) {
            return new CurlRequestParser();
        } else {
            return new HttpRequestParser();
        }
    }
}
--- 
+++ 
@@ -9,8 +9,11 @@
 }
 
 export class RequestParserFactory implements IRequestParserFactory {
+
+    private static readonly curlRegex: RegExp = /^\s*curl/i;
+
     public createRequestParser(rawHttpRequest: string): IRequestParser {
-        if (rawHttpRequest.trim().toLowerCase().startsWith('curl'.toLowerCase())) {
+        if (RequestParserFactory.curlRegex.test(rawHttpRequest)) {
             return new CurlRequestParser();
         } else {
             return new HttpRequestParser();
Update the way to check curl request
