SimonSapin/Frozen-Flask — pull request #18 by aventurella (2012-07-12 23:59:40+00:00)
Title: Generate Url Content based on headers as well.

Curious if you were interested in this idea. I needed a way to generate alternate files based on the headers sent to the servers, specifically Ajax requests (request.is_xhr).

So this enhancement will allow you to create a url generate and yield an additional type FreezerTarget, which allows the passing of headers, which in turn make the url unique.

If it's something that might be interesting, lemme know any notes you have or any concerns and I would be happy to look into it.

So the usage would look like this:

```python
@freezer.register_generator
def mycutom_test():
endpoint = "myblueprint.test"
values = {'product_id': 1}
headers = {'X-Requested-With': 'XMLHttpRequest'}
yield endpoint, values
yield FreezerTarget(endpoint=endpoint, values=values, headers=headers, filename="index_ajax")
yield FreezerTarget(endpoint=endpoint, values=values, headers={'Accept': 'application/json'}, filename="index_json")
```

It basically doesn't change the current availability of what can be yielded, it just adds the ability to also yield a FreezerTarget object in addition to string, tuples and dicts.