Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adapters/adyen-style/scripts/payment_links.star
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def on_create_payment_link(req):
if _amt_value(amount) <= 0:
return _adyen_err(422, "710", "amount.value must be greater than zero", "validation")

reference = body.get("reference", "")
reference = body.get("reference") or ""
if reference == None:
reference = ""
if reference == "":
Expand All @@ -46,7 +46,7 @@ def on_create_payment_link(req):
if reusable == None:
reusable = False

expires_at = body.get("expiresAt", "")
expires_at = body.get("expiresAt") or ""
if expires_at == None:
expires_at = ""
if expires_at == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/adyen-style/scripts/payments.star
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def on_payment_details(req):
if body == None:
body = {}

token = body.get("paymentData", "")
token = body.get("paymentData") or ""
if token == None:
token = ""
if token == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/apple-music-style/scripts/library.star
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def on_played(req):
t = body.get("type", "songs")
if t == None:
t = "songs"
ident = body.get("id", "")
ident = body.get("id") or ""
if ident == None:
ident = ""
if ident == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/apple-searchads-style/scripts/campaigns.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def on_create_campaign(req):
if body == None:
body = {}

name = body.get("name", "")
name = body.get("name") or ""
if name == "":
return respond(400, _err("Campaign name is required"))

Expand Down
24 changes: 12 additions & 12 deletions adapters/aws-cognito-style/scripts/service.star
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def on_service_api(req):
# {ClientId, Username, Password, UserAttributes: [{Name, Value}]}
def _do_signup(req):
body = _json_body(req)
username = body.get("Username", "")
password = body.get("Password", "")
username = body.get("Username") or ""
password = body.get("Password") or ""

if username == "" or password == "":
return _cognito_err("InvalidParameterException",
Expand Down Expand Up @@ -125,7 +125,7 @@ def _do_signup(req):
# {ClientId, Username, ConfirmationCode}
def _do_confirm_signup(req):
body = _json_body(req)
username = body.get("Username", "")
username = body.get("Username") or ""
if username == "":
return _cognito_err("InvalidParameterException",
"Username is required")
Expand Down Expand Up @@ -180,7 +180,7 @@ def _do_respond_to_challenge(req):
return _cognito_err("InvalidParameterException",
"ChallengeName " + challenge_name + " is not supported")

session_id = body.get("Session", "")
session_id = body.get("Session") or ""
if session_id == "":
return _cognito_err("InvalidParameterException",
"Session is required")
Expand Down Expand Up @@ -216,7 +216,7 @@ def _do_respond_to_challenge(req):
user["status"] = "CONFIRMED"
uc.update(user["id"], user)

client_id = body.get("ClientId", "")
client_id = body.get("ClientId") or ""
if client_id == "":
client_id = "mock-client-id"
return respond(200, _auth_result(user, client_id))
Expand All @@ -227,7 +227,7 @@ def _do_respond_to_challenge(req):
# {ClientId, Username}
def _do_forgot_password(req):
body = _json_body(req)
username = body.get("Username", "")
username = body.get("Username") or ""
if username == "":
return _cognito_err("InvalidParameterException",
"Username is required")
Expand Down Expand Up @@ -258,7 +258,7 @@ def _do_forgot_password(req):
# {ClientId, Username, ConfirmationCode, Password}
def _do_confirm_forgot_password(req):
body = _json_body(req)
username = body.get("Username", "")
username = body.get("Username") or ""
if username == "":
return _cognito_err("InvalidParameterException",
"Username is required")
Expand Down Expand Up @@ -305,7 +305,7 @@ def _do_confirm_forgot_password(req):
# {AccessToken}
def _do_global_sign_out(req):
body = _json_body(req)
access_token = body.get("AccessToken", "")
access_token = body.get("AccessToken") or ""

if access_token == "":
return _cognito_err("NotAuthorizedException",
Expand Down Expand Up @@ -340,7 +340,7 @@ def _do_admin_user_global_sign_out(req):
# GlobalSignOut (NotAuthorizedException).
def _do_get_user(req):
body = _json_body(req)
access_token = body.get("AccessToken", "")
access_token = body.get("AccessToken") or ""

if access_token == "":
return _cognito_err("NotAuthorizedException",
Expand Down Expand Up @@ -393,12 +393,12 @@ def _do_list_users(req):
# {UserPoolId, Username, UserAttributes, [TemporaryPassword]}
def _do_admin_create_user(req):
body = _json_body(req)
username = body.get("Username", "")
username = body.get("Username") or ""
if username == "":
return _cognito_err("InvalidParameterException",
"Username is required")

temp_password = body.get("TemporaryPassword", "")
temp_password = body.get("TemporaryPassword") or ""
if temp_password == "":
temp_password = "TempPass" + "1A!"

Expand Down Expand Up @@ -480,7 +480,7 @@ def _initiate_auth_flow(body, is_admin):
auth_params = body.get("AuthParameters", {})
if type(auth_params) != "dict":
auth_params = {}
client_id = body.get("ClientId", "")
client_id = body.get("ClientId") or ""
if client_id == "":
client_id = "mock-client-id"

Expand Down
2 changes: 1 addition & 1 deletion adapters/bluesky-style/scripts/records.star
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def on_create_record(req):
"message": "repo must match the authenticated session",
})

collection = body.get("collection", "")
collection = body.get("collection") or ""
if collection == "":
return respond(400, {
"error": "InvalidRequest",
Expand Down
4 changes: 2 additions & 2 deletions adapters/bluesky-style/scripts/session.star
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def on_create_session(req):
body = req["body"]
if body == None:
body = {}
identifier = body.get("identifier", "")
password = body.get("password", "")
identifier = body.get("identifier") or ""
password = body.get("password") or ""

if identifier == "" or password == "":
return respond(400, {
Expand Down
4 changes: 2 additions & 2 deletions adapters/braintree-style/scripts/webhooks.star
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def _register_webhook(req, body):
# notification (the simulator accepts any non-empty bt_signature/bt_payload —
# real verification is done with the merchant keypair, see lib.star).
def _verify_inbound(body):
bt_sig = body.get("bt_signature", "")
bt_payload = body.get("bt_payload", "")
bt_sig = body.get("bt_signature") or ""
bt_payload = body.get("bt_payload") or ""

if bt_sig == None:
bt_sig = ""
Expand Down
4 changes: 2 additions & 2 deletions adapters/cloudflare-style/scripts/d1.star
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def on_create_database(req):
if body == None:
return _cf_err(400, _D1_ERR, "Invalid request body.")

name = body.get("name", "")
name = body.get("name") or ""
if name == None:
name = ""
if name == "":
Expand Down Expand Up @@ -143,7 +143,7 @@ def on_query_database(req):
if body == None:
return _cf_err(400, _D1_ERR, "Missing request body.")

sql = body.get("sql", "")
sql = body.get("sql") or ""
if sql == None:
sql = ""
if sql == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/cloudflare-style/scripts/r2.star
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def on_create_bucket(req):
if body == None:
return _cf_err(400, 10004, "Invalid request body.")

name = body.get("name", "")
name = body.get("name") or ""
if name == None:
name = ""
if name == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/cloudflare-style/scripts/zones.star
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def on_create_zone(req):
if body == None:
return _cf_err(400, 1003, "Invalid or missing zone.")

name = body.get("name", "")
name = body.get("name") or ""
if name == None:
name = ""
if name == "":
Expand Down
4 changes: 2 additions & 2 deletions adapters/discord-style/scripts/oauth.star
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def on_token(req):

if grant_type == "refresh_token":
presented = body.get("refresh_token", "")
client_id = body.get("client_id", "")
client_secret = body.get("client_secret", "")
client_id = body.get("client_id") or ""
client_secret = body.get("client_secret") or ""

if client_id == "" or client_secret == "":
return respond(400, {
Expand Down
4 changes: 2 additions & 2 deletions adapters/drive-style/scripts/oauth.star
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def on_token(req):

if grant_type == "refresh_token":
presented = body.get("refresh_token", "")
client_id = body.get("client_id", "")
client_secret = body.get("client_secret", "")
client_id = body.get("client_id") or ""
client_secret = body.get("client_secret") or ""

if client_id == "" or client_secret == "":
return respond(400, {"error": "invalid_client", "error_description": "missing client creds"})
Expand Down
2 changes: 1 addition & 1 deletion adapters/entra-id-style/scripts/oauth.star
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def on_token(req):
# --- refresh_token grant ---
if grant_type == "refresh_token":
presented = body.get("refresh_token", "")
client_id = body.get("client_id", "")
client_id = body.get("client_id") or ""
client_secret = body.get("client_secret", "")

if client_id == "":
Expand Down
8 changes: 4 additions & 4 deletions adapters/firebase-style/scripts/auth.star
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def on_securetoken(req):
if grant_type != "refresh_token":
return _err(400, 400, "Only grant_type=refresh_token is supported (INVALID_GRANT_TYPE).", "INVALID_ARGUMENT")

presented = body.get("refresh_token", "")
presented = body.get("refresh_token") or ""
if presented == "":
return _err(400, 400, "refresh_token is required (MISSING_REFRESH_TOKEN).", "INVALID_ARGUMENT")

Expand Down Expand Up @@ -134,8 +134,8 @@ def on_relyingparty(req):

# _do_sign_in validates email/password against stored users and issues tokens.
def _do_sign_in(body, version):
email = body.get("email", "")
password = body.get("password", "")
email = body.get("email") or ""
password = body.get("password") or ""
if email == "" or password == "":
return _err(400, 400, "MISSING_EMAIL_OR_PASSWORD", "INVALID_ARGUMENT")

Expand All @@ -157,7 +157,7 @@ def _do_sign_in(body, version):

# _do_sign_up creates a new user and issues tokens.
def _do_sign_up(body, version):
email = body.get("email", "")
email = body.get("email") or ""
password = body.get("password", "")
display_name = body.get("displayName", "")

Expand Down
4 changes: 2 additions & 2 deletions adapters/firebase-style/scripts/fcm.star
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def on_subscribe(req):

tokens = body.get("tokens", None)
if tokens == None:
t = body.get("token", "")
t = body.get("token") or ""
if t == "":
return _err(400, 400, "token or tokens is required (MISSING_TOKEN).", "INVALID_ARGUMENT")
tokens = [t]
Expand All @@ -130,7 +130,7 @@ def on_unsubscribe(req):

tokens = body.get("tokens", None)
if tokens == None:
t = body.get("token", "")
t = body.get("token") or ""
if t == "":
return _err(400, 400, "token or tokens is required (MISSING_TOKEN).", "INVALID_ARGUMENT")
tokens = [t]
Expand Down
2 changes: 1 addition & 1 deletion adapters/firebase-style/scripts/firestore.star
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _create_path(req, project, path):
if doc_id == None:
doc_id = ""
if doc_id == "":
doc_id = body.get("documentId", "")
doc_id = body.get("documentId") or ""
if doc_id == None:
doc_id = ""

Expand Down
4 changes: 2 additions & 2 deletions adapters/google-admin-style/scripts/groups.star
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def on_create_group(req):
if body == None:
body = {}

email = body.get("email", "")
email = body.get("email") or ""
if email == "":
return respond(400, {
"error": {
Expand Down Expand Up @@ -181,7 +181,7 @@ def on_add_member(req):
if body == None:
body = {}

email = body.get("email", "")
email = body.get("email") or ""
if email == "":
return respond(400, _invalid("email is required"))

Expand Down
2 changes: 1 addition & 1 deletion adapters/google-admin-style/scripts/users.star
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def on_create_user(req):
seq = store_kv_incr("gadmin", "user_seq")
uid = "10" + _pad10(seq)

email = body.get("primaryEmail", "")
email = body.get("primaryEmail") or ""
if email == "":
email = "user" + str(seq) + "@mock-domain.com"

Expand Down
2 changes: 1 addition & 1 deletion adapters/google-iam-style/scripts/oauth.star
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def on_jwt_exchange(req):
"error_description": "Only jwt-bearer grant is supported.",
})

assertion = body.get("assertion", "")
assertion = body.get("assertion") or ""
if assertion == "":
return respond(400, {
"error": "invalid_grant",
Expand Down
2 changes: 1 addition & 1 deletion adapters/google-iam-style/scripts/roles.star
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def on_query_grantable_roles(req):
if body == None:
body = {}

full_resource_name = body.get("fullResourceName", "")
full_resource_name = body.get("fullResourceName") or ""
if full_resource_name == "":
return respond(400, {
"error": {
Expand Down
4 changes: 2 additions & 2 deletions adapters/google-style/scripts/oauth.star
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def on_token(req):

if grant_type == "refresh_token":
presented = body.get("refresh_token", "")
client_id = body.get("client_id", "")
client_secret = body.get("client_secret", "")
client_id = body.get("client_id") or ""
client_secret = body.get("client_secret") or ""

if client_id == "" or client_secret == "":
return respond(400, {"error": "invalid_client", "error_description": "missing client creds"})
Expand Down
2 changes: 1 addition & 1 deletion adapters/hn-style/scripts/auth.star
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def on_login(req):
body = req["body"]
if body == None:
body = {}
acct = body.get("acct", "")
acct = body.get("acct") or ""
pw = body.get("pw", "")

if acct == "":
Expand Down
2 changes: 1 addition & 1 deletion adapters/hn-style/scripts/submit.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def on_submit(req):
body = req["body"]
if body == None:
body = {}
title = body.get("title", "")
title = body.get("title") or ""
if title == "":
title = "(no title)"
url = body.get("url", "")
Expand Down
4 changes: 2 additions & 2 deletions adapters/instagram-style/scripts/publish.star
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def on_create(req):
body = req["body"]
if body == None:
body = {}
image_url = body.get("image_url", "")
video_url = body.get("video_url", "")
image_url = body.get("image_url") or ""
video_url = body.get("video_url") or ""
caption = body.get("caption", "")

if image_url == "" and video_url == "":
Expand Down
4 changes: 2 additions & 2 deletions adapters/jira-style/scripts/issue.star
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def on_add_comment(req):
return _not_found()

body = _get_body(req)
comment_text = body.get("body", "")
comment_text = body.get("body") or ""
if comment_text == "":
return _jira_error(400, "Comment body is required", {"comment": "Comment body can not be empty!"})

Expand Down Expand Up @@ -340,7 +340,7 @@ def on_update_comment(req):
return _not_found()

body = _get_body(req)
comment_text = body.get("body", "")
comment_text = body.get("body") or ""
if comment_text == "":
return _jira_error(400, "Comment body is required", {"comment": "Comment body can not be empty!"})

Expand Down
Loading
Loading