class WireMockMapper::Builders::RequestBuilder
Constants
- HTTP_VERBS
@!method is_a_trace Sets the request HTTP method to TRACE @return [RequestBuilder] request builder for chaining
Public Class Methods
# File lib/builders/request_builder.rb, line 7 def initialize @options = {} end
Public Instance Methods
# File lib/builders/request_builder.rb, line 114 def to_hash(*) options_with_url_match = @options.merge(@url_match.to_hash) if @url_match options_with_url_match || @options end
# File lib/builders/request_builder.rb, line 119 def to_json(*) to_hash.to_json end
Expect basic auth @param username [String] username to expect @param password [String] password to expect @return [RequestBuilder] request builder for chaining
# File lib/builders/request_builder.rb, line 64 def with_basic_auth(username, password) @options[:basicAuth] = { username: username, password: password } self end
Expect body @return [MatchBuilder] match builder to declare the match on the body
# File lib/builders/request_builder.rb, line 71 def with_body @options[:bodyPatterns] ||= [] match_builder = MatchBuilder.new(self) @options[:bodyPatterns] << match_builder match_builder end
Expect header @param key [String] the header key @return [MatchBuilder] match builder to declare the match on the header
# File lib/builders/request_builder.rb, line 89 def with_header(key) @options[:headers] ||= {} @options[:headers][key] = MatchBuilder.new(self) end
Expect query param @param key [String] the query param key @return [MatchBuilder] match builder to declare the match on the query param
# File lib/builders/request_builder.rb, line 97 def with_query_param(key) @options[:queryParameters] ||= {} @options[:queryParameters][key] = MatchBuilder.new(self) end
Expect url path with query params @return [UrlMatchBuilder] url match builder to declare the match on the url
# File lib/builders/request_builder.rb, line 104 def with_url @url_match = UrlMatchBuilder.new(self) end
Expect url path only @return [UrlMatchBuilder] url match builder to declare the match on the url
# File lib/builders/request_builder.rb, line 110 def with_url_path @url_match = UrlMatchBuilder.new(self, true) end