Commit acec63bf authored by YannGarcia's avatar YannGarcia
Browse files

Add missing templates

parent 4c79dd3f
Loading
Loading
Loading
Loading
+53 −18
Original line number Original line Diff line number Diff line
@@ -73,30 +73,49 @@ module LibItsHttp_Templates {
          body          := p_body
          body          := p_body
        } // End of template m_http_request_get
        } // End of template m_http_request_get
        
        
        template (omit) Request m_http_request_post(
        template Request mw_http_request_get(
                                                    in charstring p_uri, 
                                             template (present) charstring p_uri := ?, 
                                                    in template (value) HeaderLines p_headers,
                                             template (present) HeaderLines p_headers := ?,
                                                    in template (omit) HttpMessageBody p_body := omit
                                             template HttpMessageBody p_body := *
        ) := {
        ) := {
          method        := "POST",
          method        := "GET",
          uri           := p_uri,
          uri           := p_uri,
          version_major := c_http_version_major,
          version_major := c_http_version_major,
          version_minor := c_http_version_minor,
          version_minor := c_http_version_minor,
          header        := p_headers,
          header        := p_headers,
          body          := p_body
          body          := p_body
        } // End of template mw_http_request_get
        
        template (omit) Request m_http_request_post(
                                                    in charstring p_uri, 
                                                    in template (value) HeaderLines p_headers,
                                                    in template (omit) HttpMessageBody p_body := omit
        ) modifies m_http_request_get := {
          method        := "POST"
        } // End of template m_http_request_post
        } // End of template m_http_request_post
        
        
        template Request mw_http_request_post(
        template Request mw_http_request_post(
                                              template (present) charstring p_uri := ?, 
                                              template (present) charstring p_uri := ?, 
                                              template (present) HeaderLines p_headers := ?,
                                              template (present) HeaderLines p_headers := ?,
                                              template HttpMessageBody p_body := *
                                              template HttpMessageBody p_body := *
        ) := {
        ) modifies mw_http_request_get := {
          method        := "POST",
          method        := "POST"
          uri           := p_uri,
        } // End of template mw_http_request_post
          version_major := c_http_version_major,
        
          version_minor := c_http_version_minor,
        template (omit) Request m_http_request_delete(
          header        := p_headers,
                                                      in charstring p_uri, 
          body          := p_body
                                                      in template (value) HeaderLines p_headers,
                                                      in template (omit) HttpMessageBody p_body := omit
        ) modifies m_http_request_get := {
          method        := "DELETE"
        } // End of template m_http_request_delete
        
        template Request mw_http_request_delete(
                                                template (present) charstring p_uri := ?, 
                                                template (present) HeaderLines p_headers := ?,
                                                template HttpMessageBody p_body := *
        ) modifies mw_http_request_get := {
          method        := "DELETE"
        } // End of template mw_http_request_post
        } // End of template mw_http_request_post
        
        
    } // End of group http_requests
    } // End of group http_requests
@@ -122,7 +141,7 @@ module LibItsHttp_Templates {
          version_major := 1,
          version_major := 1,
          version_minor := 1,
          version_minor := 1,
          statuscode    := 200,
          statuscode    := 200,
          statustext    := ?,//"OK",
          statustext    := "OK",
          header        := p_header,
          header        := p_header,
          body          := p_body
          body          := p_body
      } // End of template mw_http_response_ok
      } // End of template mw_http_response_ok
@@ -132,7 +151,15 @@ module LibItsHttp_Templates {
                                                               template (present) HeaderLines p_header := ?
                                                               template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ok := {
      ) modifies mw_http_response_ok := {
          statuscode    := 201,
          statuscode    := 201,
          statustext    := ?//"Created",
          statustext    := "Created"
      } // End of template mw_http_response_ok
      
      template (present) Response mw_http_response_204_no_content(
                                                                   template (present) HttpMessageBody p_body := ?,
                                                                   template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ok := {
          statuscode    := 204,
          statustext    := "No Content"
      } // End of template mw_http_response_ok
      } // End of template mw_http_response_ok
      
      
      template (value) Response m_http_response_ko(
      template (value) Response m_http_response_ko(
@@ -179,7 +206,7 @@ module LibItsHttp_Templates {
                                                         template (present) HeaderLines p_header := ?
                                                         template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ko := {
      ) modifies mw_http_response_ko := {
          statuscode    := 400,
          statuscode    := 400,
          statustext    := ? // TODO Add pattern for not found
          statustext    := "Bad Request"
      } // End of template mw_http_response_400_bad_request
      } // End of template mw_http_response_400_bad_request
      
      
      template Response mw_http_response_403_forbidden(
      template Response mw_http_response_403_forbidden(
@@ -187,17 +214,25 @@ module LibItsHttp_Templates {
                                                       template (present) HeaderLines p_header := ?
                                                       template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ko := {
      ) modifies mw_http_response_ko := {
          statuscode    := 403,
          statuscode    := 403,
          statustext    := ? // TODO Add pattern for not found
          statustext    := "Forbidden"
      } // End of template mw_http_response_404_not_found
      } // End of template mw_http_response_403_forbidden
      
      
      template Response mw_http_response_404_not_found(
      template Response mw_http_response_404_not_found(
                                                       template HttpMessageBody p_body  := *,
                                                       template HttpMessageBody p_body  := *,
                                                       template (present) HeaderLines p_header := ?
                                                       template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ko := {
      ) modifies mw_http_response_ko := {
          statuscode    := 404,
          statuscode    := 404,
          statustext    := ? // TODO Add pattern for not found
          statustext    := "Not Found"
      } // End of template mw_http_response_404_not_found
      } // End of template mw_http_response_404_not_found
      
      
      template Response mw_http_response_412_precondition_failed(
                                                                 template HttpMessageBody p_body  := *,
                                                                 template (present) HeaderLines p_header := ?
      ) modifies mw_http_response_ko := {
          statuscode    := 412,
          statustext    := "Precondition Failed"
      } // End of template mw_http_response_412_not_found
      
    } // End of group http_responses
    } // End of group http_responses
    
    
    group http_xml_body {
    group http_xml_body {