def METHOD_NAME(expect, client, as_json):
    data = {
        "background": "https://www.gstatic.com/webp/gallery/3.png",
        "text_lines[]": ["foo", "bar"],
        "extension": "jpg",
    }
    kwargs: dict = {"content": json.dumps(data)} if as_json else {"data": data}
    request, response = client.post("/templates/custom", **kwargs)
    expect(response.status) == 201
    expect(response.json) == {
        "url": "http://localhost:5000/images/custom/foo/bar.jpg"
        "?background=https://www.gstatic.com/webp/gallery/3.png"
    }