@@ -469,7 +469,20 @@ public void SetResponseBodyString(string body)
469469 /// <param name="html">HTML content to sent.</param>
470470 /// <param name="headers">HTTP response headers.</param>
471471 /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
472- public void Ok ( string html , Dictionary < string , HttpHeader > ? headers = null ,
472+ public void Ok ( string html , IDictionary < string , HttpHeader > ? headers = null ,
473+ bool closeServerConnection = false )
474+ {
475+ Ok ( html , headers ? . Values , closeServerConnection ) ;
476+ }
477+
478+ /// <summary>
479+ /// Before request is made to server respond with the specified HTML string to client
480+ /// and ignore the request.
481+ /// </summary>
482+ /// <param name="html">HTML content to sent.</param>
483+ /// <param name="headers">HTTP response headers.</param>
484+ /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
485+ public void Ok ( string html , IEnumerable < HttpHeader > ? headers = null ,
473486 bool closeServerConnection = false )
474487 {
475488 var response = new OkResponse ( ) ;
@@ -491,7 +504,20 @@ public void Ok(string html, Dictionary<string, HttpHeader>? headers = null,
491504 /// <param name="result">The html content bytes.</param>
492505 /// <param name="headers">The HTTP headers.</param>
493506 /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
494- public void Ok ( byte [ ] result , Dictionary < string , HttpHeader > ? headers = null ,
507+ public void Ok ( byte [ ] result , IDictionary < string , HttpHeader > ? headers = null ,
508+ bool closeServerConnection = false )
509+ {
510+ Ok ( result , headers ? . Values , closeServerConnection ) ;
511+ }
512+
513+ /// <summary>
514+ /// Before request is made to server respond with the specified byte[] to client
515+ /// and ignore the request.
516+ /// </summary>
517+ /// <param name="result">The html content bytes.</param>
518+ /// <param name="headers">The HTTP headers.</param>
519+ /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
520+ public void Ok ( byte [ ] result , IEnumerable < HttpHeader > ? headers = null ,
495521 bool closeServerConnection = false )
496522 {
497523 var response = new OkResponse ( ) ;
@@ -512,7 +538,22 @@ public void Ok(byte[] result, Dictionary<string, HttpHeader>? headers = null,
512538 /// <param name="headers">The HTTP headers.</param>
513539 /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
514540 public void GenericResponse ( string html , HttpStatusCode status ,
515- Dictionary < string , HttpHeader > ? headers = null , bool closeServerConnection = false )
541+ IDictionary < string , HttpHeader > ? headers = null , bool closeServerConnection = false )
542+ {
543+ GenericResponse ( html , status , headers ? . Values , closeServerConnection ) ;
544+ }
545+
546+ /// <summary>
547+ /// Before request is made to server
548+ /// respond with the specified HTML string and the specified status to client.
549+ /// And then ignore the request.
550+ /// </summary>
551+ /// <param name="html">The html content.</param>
552+ /// <param name="status">The HTTP status code.</param>
553+ /// <param name="headers">The HTTP headers.</param>
554+ /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
555+ public void GenericResponse ( string html , HttpStatusCode status ,
556+ IEnumerable < HttpHeader > ? headers = null , bool closeServerConnection = false )
516557 {
517558 var response = new GenericResponse ( status ) ;
518559 response . HttpVersion = HttpClient . Request . HttpVersion ;
@@ -531,7 +572,21 @@ public void GenericResponse(string html, HttpStatusCode status,
531572 /// <param name="headers">The HTTP headers.</param>
532573 /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
533574 public void GenericResponse ( byte [ ] result , HttpStatusCode status ,
534- Dictionary < string , HttpHeader > headers , bool closeServerConnection = false )
575+ IDictionary < string , HttpHeader > headers , bool closeServerConnection = false )
576+ {
577+ GenericResponse ( result , status , headers ? . Values , closeServerConnection ) ;
578+ }
579+
580+ /// <summary>
581+ /// Before request is made to server respond with the specified byte[],
582+ /// the specified status to client. And then ignore the request.
583+ /// </summary>
584+ /// <param name="result">The bytes to sent.</param>
585+ /// <param name="status">The HTTP status code.</param>
586+ /// <param name="headers">The HTTP headers.</param>
587+ /// <param name="closeServerConnection">Close the server connection used by request if any?</param>
588+ public void GenericResponse ( byte [ ] result , HttpStatusCode status ,
589+ IEnumerable < HttpHeader > ? headers , bool closeServerConnection = false )
535590 {
536591 var response = new GenericResponse ( status ) ;
537592 response . HttpVersion = HttpClient . Request . HttpVersion ;
0 commit comments