Path: blob/trunk/rb/lib/selenium/webdriver/bidi/network/intercepted_request.rb
4058 views
# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819require_relative 'cookies'20require_relative 'headers'2122module Selenium23module WebDriver24class BiDi25#26# @api private27#2829class InterceptedRequest < InterceptedItem30attr_accessor :method, :url31attr_reader :body3233def initialize(network, request)34super35@method = nil36@url = nil37@body = nil38@headers = nil39@cookies = nil40end4142def continue43cookies = @cookies&.as_json44headers = @headers&.as_json45network.continue_request(46id: id,47body: body,48cookies: cookies,49headers: headers,50method: method,51url: url52)53end5455def fail56network.fail_request(id)57end5859def body=(value)60@body = {61type: 'string',62value: value.to_json63}64end6566def headers=(headers = {})67@headers = Headers.new(headers)68end6970def headers(headers = {})71@headers ||= Headers.new(headers)72end7374def cookies(cookies = {})75@cookies ||= Cookies.new(cookies)76end7778def cookies=(cookies = {})79@cookies = Cookies.new(cookies)80end81end82end # BiDi83end # WebDriver84end # Selenium858687