Attention is currently required from: dexter. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36505?usp=email ) Change subject: HTTP_Adapter: allow body to be "omit" ...................................................................... Patch Set 2: (2 comments) File library/HTTP_Adapter.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36505/comment/cd661cf5_aab37... PS1, Line 85: msg.request := {
I am not agreeing here. […] why can't you just do something like:
function f_ts_body_or_empty(template (omit) body) return template (value) charstring { if (istemplatekind(body, "omit") { return ""; } return body } template (value) HTTPMessage ts_HTTP_Req(charstring url, charstring method := "GET", template charstring body := omit, integer v_maj := 1, integer v_min := 1, charstring host, HeaderLines custom_hdr := { }) := { .request := { client_id := omit, method := method, uri := url, version_major := v_maj, version_minor := v_min, header := valueof(f_ts_HTTP_Header(body, host, custom_hdr)) body := f_ts_body_or_empty(body) } } Btw, I wonder why can't just also just pass a "body := omit" to it? What's wrong with that? File library/HTTP_Adapter.ttcn: https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36505/comment/9db23800_68289... PS2, Line 100: if (ispresent(body)) { I'm not that sure this ispresent(body) directly on a variable is what you are actually want. Did you validate it? You may need istemplatekind("omit")? You are also already using templatekind for the same stuff way up in the file. -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36505?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Ifedc8c2a590835663d1ba0b08b1fe4d54bdd0fff Gerrit-Change-Number: 36505 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Attention: dexter <pmaier@sysmocom.de> Gerrit-Comment-Date: Fri, 19 Apr 2024 14:02:14 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de> Comment-In-Reply-To: dexter <pmaier@sysmocom.de> Gerrit-MessageType: comment