@@ -136,7 +136,7 @@ Describe 'Initialize-OpenAIAPIRequestParam' {
136136 It ' AdditionalQuery parameters - test 1' {
137137 $Parameters = @ {
138138 Uri = ' https://api.openai.example.com/v1/test'
139- AdditionalQuery = @ { ' param1' = ' value1' ; ' param2' = ' value2' }
139+ AdditionalQuery = [ ordered ] @ { ' param1' = ' value1' ; ' param2' = ' value2' }
140140 }
141141 $ret = Initialize-OpenAIAPIRequestParam @Parameters
142142 $ret [' Uri' ].ToString() | Should - BeExactly ' https://api.openai.example.com/v1/test?param1=value1¶m2=value2'
@@ -145,7 +145,7 @@ Describe 'Initialize-OpenAIAPIRequestParam' {
145145 It ' AdditionalQuery parameters - test 2' {
146146 $Parameters = @ {
147147 Uri = ' https://api.openai.example.com/v1/test?existing1=param1&existing2=param2'
148- AdditionalQuery = @ { ' param1' = ' value1' ; ' param2' = ' value2' }
148+ AdditionalQuery = [ ordered ] @ { ' param1' = ' value1' ; ' param2' = ' value2' }
149149 }
150150 $ret = Initialize-OpenAIAPIRequestParam @Parameters
151151 $ret [' Uri' ].ToString() | Should - BeExactly ' https://api.openai.example.com/v1/test?existing1=param1&existing2=param2¶m1=value1¶m2=value2'
@@ -244,18 +244,21 @@ Describe 'Initialize-OpenAIAPIRequestParam' {
244244 $ret = Initialize-OpenAIAPIRequestParam @Parameters
245245 $ret [' ContentType' ] | Should - BeExactly ' multipart/form-data; boundary="boundary"'
246246 $ret [' Body' ].GetType().Name | Should - Be ' Byte[]'
247- $BodyAsString = [System.Text.Encoding ]::UTF8.GetString($ret [' Body' ])
248- $BodyAsString | Should - BeExactly (@ (
249- ' --boundary '
247+ $BodyAsString = [System.Text.Encoding ]::UTF8.GetString($ret [' Body' ]) -split ' --boundary '
248+ $BodyAsString | Should - Contain (@ (
249+ ' '
250250 ' Content-Disposition: form-data; name="Key1"'
251251 ' '
252252 ' value1'
253- ' --boundary'
253+ ' '
254+ ) -join " `r`n " )
255+ $BodyAsString | Should - Contain (@ (
256+ ' '
254257 ' Content-Disposition: form-data; name="Key2"'
255258 ' '
256259 ' value2'
257- ' --boundary-- '
258- ) -join " `r`n " ) # Should use CRLF line endings in multipart/form-data
260+ ' '
261+ ) -join " `r`n " )
259262 }
260263
261264 It ' Unknown content type' {
0 commit comments