@@ -15,26 +15,27 @@ defmodule Soap.Request.Headers do
15
15
"1.2" => "application/soap+xml; charset=utf-8" ,
16
16
}
17
17
18
- @ spec build ( map ( ) , String . t ( ) , list ( ) ) :: list ( )
19
- def build ( wsdl , operation , custom_headers ) do
18
+ @ spec build ( map ( ) , String . t ( ) , list ( ) , String . t ( ) ) :: list ( )
19
+ def build ( wsdl , operation , custom_headers , body ) do
20
20
wsdl
21
21
|> extract_soap_action_by_operation ( operation )
22
- |> extract_headers ( custom_headers , wsdl )
22
+ |> extract_headers ( custom_headers , wsdl , body )
23
23
end
24
24
25
25
@ spec extract_soap_action_by_operation ( map ( ) , String . t ( ) ) :: String . t ( )
26
26
defp extract_soap_action_by_operation ( wsdl , operation ) do
27
27
Enum . find ( wsdl [ :operations ] , fn x -> x [ :name ] == operation end ) [ :soap_action ]
28
28
end
29
29
30
- @ spec extract_headers ( String . t ( ) , list ( ) , map ( ) ) :: list ( )
31
- defp extract_headers ( soap_action , [ ] , wsdl ) , do: base_headers ( soap_action , wsdl )
32
- defp extract_headers ( _ , custom_headers , _ ) , do: custom_headers
30
+ @ spec extract_headers ( String . t ( ) , list ( ) , map ( ) , String . t ( ) ) :: list ( )
31
+ defp extract_headers ( soap_action , [ ] , wsdl , body ) , do: base_headers ( soap_action , wsdl , body )
32
+ defp extract_headers ( _ , custom_headers , _ , _ ) , do: custom_headers
33
33
34
- @ spec base_headers ( String . t ( ) , map ( ) ) :: list ( )
35
- defp base_headers ( soap_action , wsdl ) do
34
+ @ spec base_headers ( String . t ( ) , map ( ) , String . t ( ) ) :: list ( )
35
+ defp base_headers ( soap_action , wsdl , body ) do
36
36
uri = URI . parse ( wsdl [ :endpoint ] )
37
37
[
38
+ { "Content-Length" , byte_size ( body ) } ,
38
39
{ "Content-Type" , Map . get ( @ content_types , wsdl [ :soap_version ] ) } ,
39
40
{ "User-Agent" , "strong-soap/3.4.0" } ,
40
41
{ "Accept" , "text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8" } ,
0 commit comments