17
17
#endregion
18
18
19
19
using System ;
20
+ using JetBrains . Annotations ;
20
21
using RestSharp . Validation ;
21
22
22
23
namespace RestSharp
@@ -32,7 +33,7 @@ public Parameter(string name, object value, ParameterType type)
32
33
Ensure . NotEmpty ( name , nameof ( name ) ) ;
33
34
34
35
Name = name ;
35
- Value = value ;
36
+ Value = type != ParameterType . UrlSegment ? value : value . ToString ( ) . Replace ( "%2F" , "/" ) . Replace ( "%2f" , "/" ) ;
36
37
Type = type ;
37
38
}
38
39
@@ -41,12 +42,12 @@ public Parameter(string name, object value, ParameterType type)
41
42
/// <summary>
42
43
/// Name of the parameter
43
44
/// </summary>
44
- public string Name { get ; set ; }
45
+ public string ? Name { get ; set ; }
45
46
46
47
/// <summary>
47
48
/// Value of the parameter
48
49
/// </summary>
49
- public object Value { get ; set ; }
50
+ public object ? Value { get ; set ; }
50
51
51
52
/// <summary>
52
53
/// Type of the parameter
@@ -61,7 +62,7 @@ public Parameter(string name, object value, ParameterType type)
61
62
/// <summary>
62
63
/// MIME content type of the parameter
63
64
/// </summary>
64
- public string ContentType { get ; set ; }
65
+ public string ? ContentType { get ; set ; }
65
66
66
67
/// <summary>
67
68
/// Return a human-readable representation of this parameter
@@ -85,6 +86,7 @@ public override bool Equals(object obj)
85
86
=> ! ReferenceEquals ( null , obj )
86
87
&& ( ReferenceEquals ( this , obj ) || obj . GetType ( ) == this . GetType ( ) && Equals ( ( Parameter ) obj ) ) ;
87
88
89
+ // ReSharper disable NonReadonlyMemberInGetHashCode
88
90
public override int GetHashCode ( )
89
91
{
90
92
unchecked
@@ -98,18 +100,19 @@ public override int GetHashCode()
98
100
return hashCode ;
99
101
}
100
102
}
103
+ // ReSharper enable NonReadonlyMemberInGetHashCode
101
104
}
102
105
103
106
public class XmlParameter : Parameter
104
107
{
105
- public XmlParameter ( string name , object value , string xmlNamespace = null ) : base ( name , value , ParameterType . RequestBody )
108
+ public XmlParameter ( string name , object value , string ? xmlNamespace = null ) : base ( name , value , ParameterType . RequestBody )
106
109
{
107
110
XmlNamespace = xmlNamespace ;
108
111
DataFormat = DataFormat . Xml ;
109
112
ContentType = Serialization . ContentType . Xml ;
110
113
}
111
114
112
- public string XmlNamespace { get ; }
115
+ public string ? XmlNamespace { get ; }
113
116
}
114
117
115
118
public class JsonParameter : Parameter
0 commit comments