///|
/// Get the first listening URI of the server (for tests).
#borrow(self)
pub extern "c" fn Server::get_first_uri(self : Server) -> @glib.Uri = "moonbit_soup_server_get_first_uri"

///|
#borrow(self_, content_type, body)
extern "c" fn ServerMessage::ffi_set_response(
  self_ : ServerMessage,
  content_type : @glib.Nullable[Bytes],
  content_type_is_null : Int,
  body : @glib.Nullable[Bytes],
  body_is_null : Int,
) = "moonbit_soup_server_message_set_response"

///|
/// Set the response body on a ServerMessage.
pub fn ServerMessage::set_response(
  self : ServerMessage,
  content_type : String?,
  body : String?,
) -> Unit {
  ServerMessage::ffi_set_response(
    self,
    match content_type {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
    if content_type is None {
      1
    } else {
      0
    },
    match body {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
    if body is None {
      1
    } else {
      0
    },
  )
}