Ejemplo n.º 1
0
        public FormRecognizerRecordMatcher() : base(compareBodies: false)
        {
            // TODO:
            // "Content-Length" header is being ignored because we are not sanitizing the request body, which
            // contains the FORM_RECOGNIZER_BLOB_CONTAINER_SAS_URL sanitized variable. For this reason, a length
            // mismatch happens. We can safely remove this line when body sanitizing is in place (we may want to
            // enable request body matching as well).

            ExcludeHeaders.Add("Content-Length");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// All optional settings are safely defaulted. This means that providing zero additional configuration will produce a sanitizer that is functionally identical to the default.
        /// </summary>
        /// <param name="compareBodies">Should the body value be compared during lookup operations?</param>
        /// <param name="excludedHeaders">A comma separated list of additional headers that should be excluded during matching.</param>
        /// /// <param name="ignoredHeaders">A comma separated list of additional headers that should be ignored during matching.</param>
        /// <param name="ignoreQueryOrdering">By default, the test-proxy does not sort query params before matching. Setting true will sort query params alphabetically before comparing URI.</param>
        public CustomDefaultMatcher(bool compareBodies = true, string excludedHeaders = "", string ignoredHeaders = "", bool ignoreQueryOrdering = false) : base(compareBodies: compareBodies, ignoreQueryOrdering: ignoreQueryOrdering)
        {
            foreach (var exclusion in excludedHeaders.Split(",").Where(x => !string.IsNullOrEmpty(x.Trim())))
            {
                if (!ExcludeHeaders.Contains(exclusion))
                {
                    ExcludeHeaders.Add(exclusion);
                }
            }

            foreach (var exclusion in ignoredHeaders.Split(",").Where(x => !string.IsNullOrEmpty(x.Trim())))
            {
                if (!IgnoredHeaders.Contains(exclusion))
                {
                    IgnoredHeaders.Add(exclusion);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// All optional settings are safely defaulted. This means that providing zero additional configuration will produce a sanitizer that is functionally identical to the default.
        /// </summary>
        /// <param name="compareBodies">Should the body value be compared during lookup operations?</param>
        /// <param name="excludedHeaders">A comma separated list of additional headers that should be excluded during matching. "Excluded" headers are entirely ignored. Unlike "ignored" headers, the presence (or lack of presence) of a header
        /// will not cause mismatch.</param>
        /// <param name="ignoredHeaders">A comma separated list of additional headers that should be ignored during matching. Any headers that are "ignored" will not do value comparison when matching. This means that if the recording has a header
        /// that isn't in the request, a test mismatch exception will be thrown noting the lack of header in the request. This also applies if the header is present in the request but not recording.</param>
        /// <param name="ignoreQueryOrdering">By default, the test-proxy does not sort query params before matching. Setting true will sort query params alphabetically before comparing URI.</param>
        /// <param name="ignoredQueryParameters">A comma separated list of query parameterse that should be ignored during matching.</param>
        public CustomDefaultMatcher(bool compareBodies = true, string excludedHeaders = "", string ignoredHeaders = "", bool ignoreQueryOrdering = false, string ignoredQueryParameters = "")
            : base(compareBodies: compareBodies, ignoreQueryOrdering: ignoreQueryOrdering)
        {
            const StringSplitOptions splitOptions = StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries;

            foreach (var exclusion in excludedHeaders.Split(",", splitOptions))
            {
                ExcludeHeaders.Add(exclusion);
            }

            foreach (var exclusion in ignoredHeaders.Split(",", splitOptions))
            {
                IgnoredHeaders.Add(exclusion);
            }

            foreach (var exclusion in ignoredQueryParameters.Split(",", splitOptions))
            {
                IgnoredQueryParameters.Add(exclusion);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// This matcher adjusts the "match" operation to EXCLUDE the body when matching a request to a recording's entries.
 /// </summary>
 public BodilessMatcher() : base(false)
 {
     // when we are ignoring bodies, we should also ignore any header that is directly
     // influenced by said body
     ExcludeHeaders.Add("Content-Length");
 }
Ejemplo n.º 5
0
 public TablesRecordMatcher(RecordedTestSanitizer sanitizer) : base(sanitizer)
 {
     ExcludeHeaders.Add("Content-Type");
 }
Ejemplo n.º 6
0
 public MixedRealityRecordMatcher()
 {
     ExcludeHeaders.Add(ClientCorrelationVectorHeaderName);
     VolatileHeaders.Add(ClientCorrelationVectorHeaderName);
     VolatileResponseHeaders.Add(ClientCorrelationVectorHeaderName);
 }