Skip to content

Commit

Permalink
Remove now-unneeded OPTIONs methods
Browse files Browse the repository at this point in the history
Fixes #93
  • Loading branch information
ajnisbet committed Feb 19, 2024
1 parent b903632 commit 0b64919
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 5 additions & 5 deletions opentopodata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,16 +458,16 @@ def _get_datasets(name):
return datasets


@app.route("/", methods=["GET", "POST", "OPTIONS", "HEAD"])
@app.route("/v1/", methods=["GET", "POST", "OPTIONS", "HEAD"])
@app.route("/", methods=["GET", "POST", "HEAD"])
@app.route("/v1/", methods=["GET", "POST", "HEAD"])
def get_help_message():
msg = "No dataset name provided."
msg += " Try a url like '/v1/test-dataset?locations=-10,120' to get started,"
msg += " and see https://www.opentopodata.org for full documentation."
return jsonify({"status": "INVALID_REQUEST", "error": msg}), 404


@app.route("/health", methods=["GET", "OPTIONS", "HEAD"])
@app.route("/health", methods=["GET", "HEAD"])
def get_health_status():
"""Status endpoint for e.g., uptime check or load balancing."""
try:
Expand All @@ -480,7 +480,7 @@ def get_health_status():
return jsonify(data), 500


@app.route("/datasets", methods=["GET", "OPTIONS", "HEAD"])
@app.route("/datasets", methods=["GET", "HEAD"])
def get_datasets_info():
"""List of datasets on the server."""
try:
Expand All @@ -501,7 +501,7 @@ def get_datasets_info():
return jsonify(data), 500


@app.route("/v1/<dataset_name>", methods=["GET", "POST", "OPTIONS", "HEAD"])
@app.route("/v1/<dataset_name>", methods=["GET", "POST", "HEAD"])
def get_elevation(dataset_name):
"""Calculate the elevation for the given locations.
Expand Down
2 changes: 0 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import math

import pytest
from flask_caching import Cache
import rasterio
from unittest.mock import patch
import numpy as np
from flask import request

from opentopodata import api
from opentopodata import backend
from opentopodata import config


GEOTIFF_PATH = "tests/data/datasets/test-etopo1-resampled-1deg/ETOPO1_Ice_g_geotiff.resampled-1deg.tif"
Expand Down

0 comments on commit 0b64919

Please sign in to comment.