Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query params and regional routing in emulated HTTP functions #3033

Merged
merged 6 commits into from
Jan 14, 2021

Conversation

samtstern
Copy link
Contributor

@samtstern samtstern commented Jan 14, 2021

Description

Fixes #3031
Fixes #3032

Scenarios Tested

const functions = require("firebase-functions");
const express = require('express');

const server = express();
server.get('/', (req, res) => {
    res.send('lol!');
});

exports.helloWorld = functions.https.onRequest((req,res) => {
    res.json(req.query);
});

exports.api = functions.region('europe-west3').https.onRequest(server);

For #3032

$ http "http://localhost:5001/fir-dumpster/us-central1/helloWorld"
HTTP/1.1 200 OK
connection: keep-alive
content-length: 2
content-type: application/json; charset=utf-8
date: Thu, 14 Jan 2021 14:19:19 GMT
etag: W/"2-vyGp6PvFo4RvsFtPoIWeCReyIC8"
keep-alive: timeout=5
x-powered-by: Express

{}
$ http "http://localhost:5001/fir-dumpster/us-central1/helloWorld?id=ok"
HTTP/1.1 200 OK
connection: keep-alive
content-length: 11
content-type: application/json; charset=utf-8
date: Thu, 14 Jan 2021 14:19:09 GMT
etag: W/"b-O3GjgUzPF1NwRnSW+tWJECMBW0k"
keep-alive: timeout=5
x-powered-by: Express

{
    "id": "ok"
}
$ http "http://localhost:5001/fir-dumpster/us-central1/helloWorld/?id=ok"
HTTP/1.1 200 OK
connection: keep-alive
content-length: 11
content-type: application/json; charset=utf-8
date: Thu, 14 Jan 2021 14:19:02 GMT
etag: W/"b-O3GjgUzPF1NwRnSW+tWJECMBW0k"
keep-alive: timeout=5
x-powered-by: Express

{
    "id": "ok"
}
$ http "http://localhost:5001/fir-dumpster/us-central1/helloWorld/?foo=bar&baz=quz"
HTTP/1.1 200 OK
connection: keep-alive
content-length: 25
content-type: application/json; charset=utf-8
date: Thu, 14 Jan 2021 14:18:48 GMT
etag: W/"19-aJ5/6qdD+JUaYGoi+SY23wQdu+Y"
keep-alive: timeout=5
x-powered-by: Express

{
    "baz": "quz",
    "foo": "bar"
}

For #3031

$ http http://localhost:5001/fir-dumpster/europe-west3/api
HTTP/1.1 200 OK
connection: keep-alive
content-length: 4
content-type: text/html; charset=utf-8
date: Thu, 14 Jan 2021 15:25:01 GMT
etag: W/"4-aGtZBCd1zhmF98IwfKTshS0CjO4"
keep-alive: timeout=5
x-powered-by: Express

lol!

Sample Commands

N/A

@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Jan 14, 2021
@coveralls
Copy link

coveralls commented Jan 14, 2021

Coverage Status

Coverage decreased (-0.01%) to 65.538% when pulling dd15ae3 on ss-fix-3032 into b26aa46 on master.

@samtstern
Copy link
Contributor Author

@bkendall something is not right with Coveralls, I added a unit test and changed one line which is covered by that test and my coverage decreased?

@samtstern samtstern changed the title Fix query params in emulated HTTP functions Fix query params and regional routing in emulated HTTP functions Jan 14, 2021
@samtstern samtstern merged commit 10524fc into master Jan 14, 2021
@bkendall bkendall deleted the ss-fix-3032 branch August 4, 2021 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
3 participants