Making WordPress.org


Ignore:
Timestamp:
01/31/2018 04:03:15 AM (8 years ago)
Author:
dd32
Message:

API: Theme Directory: Disallow POST requests to the info/1.2 api endpoint.

See #111

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/themes/info/1.2/index.php

    r6465 r6483  
    11<?php
    22
    3 if ( ! defined( 'THEMES_API_SUPPORTS_ERRORS' ) ) {
    4     define( 'THEMES_API_SUPPORTS_ERRORS', true );
     3// Version 1.2+ only accepts GET requests
     4if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
     5    header( $_SERVER['SERVER_PROTOCOL'] . ' 405 Method not allowed' );
     6    header( 'Allow: GET' );
     7    header( 'Content-Type: text/plain' );
     8
     9    die( 'This API only serves GET requests.' );
    510}
    611
Note: See TracChangeset for help on using the changeset viewer.