Class: Http2::PostMultipartRequest

Inherits:
BaseRequest show all
Defined in:
lib/http2/post_multipart_request.rb

Constant Summary

Constants inherited from BaseRequest

BaseRequest::VALID_ARGUMENTS_POST

Instance Attribute Summary collapse

Attributes inherited from BaseRequest

#args, #debug, #http2

Instance Method Summary collapse

Methods inherited from BaseRequest

#path

Constructor Details

#initialize(http2, *args) ⇒ PostMultipartRequest

Returns a new instance of PostMultipartRequest.



6
7
8
9
10
11
12
# File 'lib/http2/post_multipart_request.rb', line 6

def initialize(http2, *args)
  super

  @phash = @args[:post].clone
  @http2.autostate_set_on_post_hash(phash) if @http2.autostate
  @boundary = rand(36**50).to_s(36)
end

Instance Attribute Details

#headers_stringObject (readonly)

Returns the value of attribute headers_string.



4
5
6
# File 'lib/http2/post_multipart_request.rb', line 4

def headers_string
  @headers_string
end

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/http2/post_multipart_request.rb', line 14

def execute
  generate_raw(@phash) do |_helper, praw|
    @http2.mutex.synchronize do
      @conn.write(header_string_with_raw_post(praw))

      praw.rewind
      praw.each_line do |data|
        @conn.sock_write(data)
      end

      return @http2.read_response(self, @args)
    end
  end
end