Skip to content

Commit cfae128

Browse files
Ace NassriTakashi Matsuo
Ace Nassri
and
Takashi Matsuo
authored
chore(functions/pubsub): use consistent param names (GoogleCloudPlatform#4823)
Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
1 parent d53978b commit cfae128

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

functions/pubsub/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
# Instantiates a Pub/Sub client
2424
publisher = pubsub_v1.PublisherClient()
25-
PROJECT_ID = os.getenv('GCP_PROJECT')
25+
PROJECT_ID = os.getenv('GOOGLE_CLOUD_PROJECT')
2626

2727

2828
# Publishes a message to a Cloud Pub/Sub topic.
@@ -33,7 +33,7 @@ def publish(request):
3333
message = request_json.get("message")
3434

3535
if not topic_name or not message:
36-
return ('Missing "topic" and/or "subscription" parameter.', 500)
36+
return ('Missing "topic" and/or "message" parameter.', 400)
3737

3838
print(f'Publishing message to topic {topic_name}')
3939

functions/pubsub/main_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_functions_pubsub_publish_should_fail_without_params():
2828
request.get_json.return_value = {}
2929
response = main.publish(request)
3030

31-
assert 'Missing "topic" and/or "subscription" parameter.' in response
31+
assert 'Missing "topic" and/or "message" parameter.' in response
3232

3333

3434
def test_functions_pubsub_publish_should_publish_message():

0 commit comments

Comments
 (0)